Home > Net >  Nginx Reverse Proxy: Throwing 502 Bad Gateway
Nginx Reverse Proxy: Throwing 502 Bad Gateway

Time:11-25

I was following this tutorial to learn about Reverse Proxy enter image description here

Also, I'm able to access localhost:3000 and localhost:8086/test

Not sure why nginx is throwing 502, did I miss any configuration?

CodePudding user response:

Bad Gateway 502 is typically a sign that your destination server is not responding. I assume your other services are Docker container as well? If that is the case you could try to change localhost to their containername and use Docker-dns. But you need to put all containers in the same network for that to work.

Another thing to try is to reverse your order of routes. If I remember correctly nginx takes the first matching route. In your case / matches every other route so every request is directed to your nginx. But your nginx can't handle /test or /home.

I hope this will help you to find the problem.

  • Related