I have a server with multiple web-servers in separate docker containers and an nginx reverse-proxy. It is sitting behind a NAT with 1 public IP, which forwards connections on ports 80 and 443 to my server so nginx can proxy them according to the domain. This part works fine.
However, I need 2 containers to communicate with each other using the public domain name (nextcloud requires onlyoffice’s full domain name for some reason), and when I curl/wget from the server to the url of one of the containers, I get connection refused.
As I understand it, packets have the server’s IP as both source and destinations, so the response is being sent to the localhost, and hairpin NAT rule on my NAT didn’t solve the issue.
So, how should I fix this?
Thanks everyone in advance.