Skip to content

Instantly share code, notes, and snippets.

@Schepp
Created May 23, 2013 19:20
Show Gist options
  • Save Schepp/5638708 to your computer and use it in GitHub Desktop.
Save Schepp/5638708 to your computer and use it in GitHub Desktop.
# This .htaccess needs Apache with:
# mod_rewrite
# mod_headers
# mod_proxy
# SSL certificate
# Proxies "https://api.twitter.com.cors-proxy.io/1.1/statuses/mentions_timeline.json?count=2&since_id=14927799"
# To: "https://api.twitter.com/1.1/statuses/mentions_timeline.json?count=2&since_id=14927799"
# All while setting CORS header on the fly
<IfModule mod_headers.c>
Header set Access-Control-Allow-Origin: "*"
</IfModule>
<IfModule mod_rewrite.c>
RewriteCond %{SERVER_PORT} ^80
RewriteCond %{HTTP_HOST} ^(.+)\.cors-proxy\.io$
RewriteRule ^(.*)$ http://%1/$1 [P,QSA,L]
RewriteCond %{SERVER_PORT} ^443
RewriteCond %{HTTP_HOST} ^(.+)\.cors-proxy\.io$
RewriteRule ^(.*)$ https://%1/$1 [P,QSA,L]
</IfModule>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment