Skip to content

Instantly share code, notes, and snippets.

@maxparm
Created July 13, 2012 15:37
Show Gist options
  • Star 8 You must be signed in to star a gist
  • Fork 6 You must be signed in to fork a gist
  • Save maxparm/3105526 to your computer and use it in GitHub Desktop.
Save maxparm/3105526 to your computer and use it in GitHub Desktop.
.htaccess with appropriate CORS header
<IfModule mod_rewrite.c>
Header add Access-Control-Allow-Origin "*"
Header add Access-Control-Allow-Methods: "GET,POST,OPTIONS,DELETE,PUT"
Header add Access-Control-Allow-Headers: "Content-Type"
RewriteEngine on
RewriteBase /
</IfModule>
@Potherca
Copy link

You have a typo: Header add Access-Control-Allow-Origin "*" is missing a colon ':' it should be:

  Header add Access-Control-Allow-Origin: "*"

@MatthewVance
Copy link

Shouldn't it be <IfModule mod_headers.c> rather than mod_rewrite.c?

@javedusmani2
Copy link

Thanks for sharing a great information with us, it really amazing.

For information purpose for others, You can also have a look at this article which allow CORS header.

@MitziMercedes
Copy link

Legend, thanks 💯

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment