TransWikia.com

Nginx proxy_pass keeps redirecting to localhost

Server Fault Asked on January 3, 2022

I am trying to set up a reverse proxy from my domain to http://127.0.0.1:4000. My issue is that whenever I try to open https://example.com (not the actual domain) in a browser, I just get redirected to http://localhost on my own machine. There is nothing listening on the server at http://127.0.0.1:4000 yet. I am just trying to see the 504 error screen.

server {
        listen 443 ssl;

        server_name example.com;

        ssl_certificate /etc/letsencrypt/live/example.com/fullchain.pem;
        ssl_certificate_key /etc/letsencrypt/live/example.com/privkey.pem;

        location / {
                proxy_pass http://127.0.0.1:4000;
        }
}

The domain does point to this server. I am able to connect to the server via this domain, but when I view it in a browser I always get redirected to http://localhost.

EDIT: I just tried it in another browser and realized it was Chrome doing the redirect. The server works fine.

2 Answers

504 Gateway Timeout error means that nginx was able to succesfully connect and send request to the 127.0.0.1:4000 server, but did not receive a response within expected time.

To see that error message, you need to have a server running on the port, and make it not send a reply within timeout specified in nginx configuration.

Answered by Tero Kilkanen on January 3, 2022

Nevermind, I tried it in another browser and it worked fine. Chrome is just stuck redirecting me for some reason...

Answered by chrispytoes on January 3, 2022

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP