Skip to content

Instantly share code, notes, and snippets.

@Saigesp
Last active December 13, 2021 15:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Saigesp/a49a1d8394509422f638a4ceaac3c552 to your computer and use it in GitHub Desktop.
Save Saigesp/a49a1d8394509422f638a4ceaac3c552 to your computer and use it in GitHub Desktop.
Nginx proxy pass example to avoid CORS on development
server {
listen 8008;
server_name localhost;
add_header 'Access-Control-Allow-Origin' '$http_origin';
add_header 'Access-Control-Allow-Credentials' 'true';
add_header 'Access-Control-Allow-Headers' 'Authorization,Accept,Origin,DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Content-Range,Range';
add_header 'Access-Control-Allow-Methods' 'GET,POST,OPTIONS,PUT,DELETE,PATCH';
location / {
proxy_pass http://localhost:8000/;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment