0

I was trying to route my localhost:8585 requests to some external url, say https://someExternalSite.xyz. Such that i can access the external site using localhost port url in my app.

i.e if i curl localhost:8585, it should actually return the output of curl https://someExternalSite.xyz

I have tried this configuration but not working

server {
    listen 8585;
    listen [::]:8585;
    server_name localhost;

    location / {
                proxy_pass https://someExternalSite.xyz/;
                proxy_set_header X-Real-IP $remote_addr;
                proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
                proxy_set_header Host $host;
                proxy_set_header X-NginX-Proxy true;
    }
}

Need some help

Dushyanth Kumar Reddy
  • 1,222
  • 11
  • 21
  • I think the answer to your question is here https://stackoverflow.com/questions/38345233/nginx-proxy-pass-to-external-url – Yoandry Collazo Oct 12 '20 at 13:59
  • Thanks for responding, but that was the different scenario. That was proxy passing request of example1.com to example2.com. But i was trying to proxy localhost:8585 to an external url – Dushyanth Kumar Reddy Oct 12 '20 at 14:10

0 Answers0