Skip to content

Instantly share code, notes, and snippets.

@awojtczyk
Last active August 29, 2015 14:24
Show Gist options
  • Save awojtczyk/c844bffe6bb399168cc7 to your computer and use it in GitHub Desktop.
Save awojtczyk/c844bffe6bb399168cc7 to your computer and use it in GitHub Desktop.
CORS configuration with AngularJS and WordPress
# CORS Headers (add this)
<ifModule mod_headers.c>
Header always set Access-Control-Allow-Origin: "*"
Header always set Access-Control-Allow-Methods "POST, GET, PUT, DELETE, OPTIONS"
Header always set Access-Control-Allow-Headers "X-Requested-With, content-type"
</ifModule>
# BEGIN WordPress (you should have this in your original WP .htaccess)
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
# CORS OPTIONS (add this too)
RewriteCond %{REQUEST_METHOD} OPTIONS
RewriteRule ^(.*)$ $1 [R=200,L]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment