Created
August 27, 2013 12:53
-
-
Save ykrkn/6353117 to your computer and use it in GitHub Desktop.
nginx CORS configuration
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
location /api { | |
proxy_pass http://localhost:8080/api; | |
proxy_set_header Host $host; | |
proxy_set_header X-Real-IP $remote_addr; | |
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; | |
add_header Access-Control-Allow-Origin *; | |
if ($request_method = OPTIONS ) { | |
add_header Allow 'POST, GET, PUT, DELETE, OPTIONS'; | |
add_header Access-Control-Allow-Origin *; | |
add_header Access-Control-Allow-Headers 'accept, origin, content-type'; | |
add_header Access-Control-Allow-Methods 'POST, GET, PUT, DELETE, OPTIONS'; | |
return 200; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment