had to manually set the Host header to the hostname (the container name in my case):
proxy_set_header Host chat-ui; # Set Host header explicitly to chat-ui
When I ran a nslookup <api-container-name>
from within the nginx container, I noticed that curl <resolved-ip-address>
gave a 404, while a curl <api-container-name>
got me a 200.
I don't entirely understand what's going on, but it seems Azure's internal routing system uses the Host header to find the right service, and the internal IP of that service is not meant to be used directly. I guess nginx sets the Host header to itself rather than the container it's forwarding to.
If anyone has a better explanation, let me know!