Skip to content

Instantly share code, notes, and snippets.

@tsvetomir
Created March 18, 2015 11:38
Show Gist options
  • Save tsvetomir/1658ebbdfdc705c78780 to your computer and use it in GitHub Desktop.
Save tsvetomir/1658ebbdfdc705c78780 to your computer and use it in GitHub Desktop.
NGinx - CORS proxy
location /foo {
if ($request_method = 'OPTIONS') {
add_header 'Access-Control-Allow-Origin' '*';
add_header 'Access-Control-Allow-Methods' 'POST, GET, PUT, DELETE, OPTIONS';
add_header 'Access-Control-Allow-Headers' '*';
add_header 'Access-Control-Max-Age' 1728000;
add_header 'Content-Type' 'text/plain charset=UTF-8';
add_header 'Content-Length' 0;
return 200;
}
proxy_pass http://foo.com/;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment