I want to run a Mailcow instance behind a reverse proxy. Both the Mailcow server and the reverse proxy are separate Docker containers. I’ve set up both containers, and both run without problems on their own. However, when I try to forward from the reverse proxy to the Mailcow server, I get the error message 502 - Bad Gateway, which tells me that the reverse proxy can’t reach the Mailcow server.
When I try to reach the Mailcow instance with curl 127.0.0.1:8080, I get a response. From this, I conclude that the Mailcow configuration is basically correct.
What have I done so far?
- I followed the instructions for setting up a reverse proxy with Mailcow - without success.
- I tried various addresses for the TRUSTED_PROXIES parameter - without success.
- Then I looked up the topic of networks in Docker. Since 127.0.0.1 is the loopback address of my own container, I used the Docker host address (in my case 172.17.0.1) - without success.
So far, I am convinced, that there is a routing problem between the container of the reverse proxy container and the mailcow container.