I'd like to use nginx locally to bypass CORS in browser. I'm having trouble with getting the request back out of nginx. How would I get it to call an address back in my own pc's environment/context after getting the request on localhost:5000.
My nginx.conf
server
{
listen 5000;
server_name localhost;
location / {
resolver 127.0.0.11;
set $example some-website-with-cors.com;
proxy_pass http://$example;
if ($request_method = 'OPTIONS') {
add_header 'Access-Control-Allow-Origin' '*';
add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS';
add_header 'Access-Control-Allow-Headers' 'DNT,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Range';
add_header 'Access-Control-Max-Age' 1728000;
add_header 'Content-Type' 'text/plain; charset=utf-8';
add_header 'Content-Length' 0;
return 204;
}
}
}
I'm building this and running docker run -p 5000:5000 proxy:latest
Nginx+docker wouldn't know how to reach some-website-with-cors.com
back in my env. How can I tell it where to refer the request?