What were you trying to achieve?
I was trying to run the framework with the provided Docker Compose and Nginx setup, and access services through Nginx as the reverse proxy. The goal was to keep upstream targets configurable through variables instead of hardcoding service names and ports directly in the Nginx locations.
What are the expected results?
Nginx should successfully proxy requests to backend services defined in the Docker Compose network, such as auth, users, and other services. Accessing service endpoints such as /health through Nginx should return the corresponding upstream responses instead of gateway errors.
What are the received results?
Nginx returns 502 Bad Gateway for all proxied services when accessed from outside the container through the exposed Nginx endpoint.
Important detail: the backend services themselves are reachable from inside the nginx container. For example, sending a request directly from the nginx container to a backend service succeeds:
docker exec nginx sh -c 'wget -S -O - http://clients:9006/health'
Response from inside the nginx container:
Connecting to clients:9006 (172.30.0.58:9006)
HTTP/1.1 200 OK
Content-Type: application/health+json
Date: Thu, 23 Apr 2026 02:23:16 GMT
Content-Length: 209
Connection: close
writing to stdout
- 100% |********************************| 209 0:00:00 ETA
written to stdout
{"status":"pass","version":"v0.19.0","commit":"3f0f3e9f915587946268be0bd387944c96698f5d","description":"clients service","build_time":"2026-04-22_16:48:35","instance_id":"3e0b3ed3-b8a8-49f2-bba9-9971463a3751"}
However, accessing the same endpoint through the externally exposed Nginx endpoint returns 502 Bad Gateway:
curl -i http://localhost/health
Response from the exposed Nginx endpoint:
HTTP/1.1 502 Bad Gateway
Server: nginx/1.29.2
Date: Thu, 23 Apr 2026 02:27:46 GMT
Content-Type: text/html
Content-Length: 157
Connection: keep-alive
<html>
<head><title>502 Bad Gateway</title></head>
<body>
<center><h1>502 Bad Gateway</h1></center>
<hr><center>nginx/1.29.2</center>
</body>
</html>
Steps To Reproduce
1.Start the stack with the provided Docker Compose configuration.
2.Use the default Nginx template pattern where upstream targets are assigned through nginx variables, for example:
set $clients_upstream "clients:${MG_CLIENTS_HTTP_PORT}";
location /health {
include snippets/proxy-headers.conf;
proxy_pass http://$clients_upstream;
}
3.Ensure the services are running and attached to the same Docker network.
4.Verify that a backend service is reachable directly from inside the nginx container:
docker exec nginx sh -c 'wget -S -O - http://clients:9006/health'
5.Access the exposed Nginx entrypoint from outside the container, for example:
curl -i http://localhost/health
6.Observe that Nginx returns 502 Bad Gateway not only for one service, but for all proxied services using the same pattern.
In what environment did you encounter the issue?
- Deployment method: Docker Compose
- Reverse proxy: Nginx container
- Network mode: Docker bridge network created by Compose
- Nginx image: nginx:1.29.2-alpine3.22
- Framework configuration: repository-provided docker/docker-compose.yaml and docker/nginx/nginx-key.conf
- OS: Linux
Additional information you deem important
No response
What were you trying to achieve?
I was trying to run the framework with the provided Docker Compose and Nginx setup, and access services through Nginx as the reverse proxy. The goal was to keep upstream targets configurable through variables instead of hardcoding service names and ports directly in the Nginx locations.
What are the expected results?
Nginx should successfully proxy requests to backend services defined in the Docker Compose network, such as auth, users, and other services. Accessing service endpoints such as /health through Nginx should return the corresponding upstream responses instead of gateway errors.
What are the received results?
Nginx returns
502 Bad Gatewayfor all proxied services when accessed from outside the container through the exposed Nginx endpoint.Important detail: the backend services themselves are reachable from inside the
nginxcontainer. For example, sending a request directly from thenginxcontainer to a backend service succeeds:docker exec nginx sh -c 'wget -S -O - http://clients:9006/health'Response from inside the nginx container:
However, accessing the same endpoint through the externally exposed Nginx endpoint returns
502 Bad Gateway:curl -i http://localhost/healthResponse from the exposed Nginx endpoint:
Steps To Reproduce
1.Start the stack with the provided Docker Compose configuration.
2.Use the default Nginx template pattern where upstream targets are assigned through nginx variables, for example:
3.Ensure the services are running and attached to the same Docker network.
4.Verify that a backend service is reachable directly from inside the
nginxcontainer:5.Access the exposed Nginx entrypoint from outside the container, for example:
6.Observe that Nginx returns
502 Bad Gatewaynot only for one service, but for all proxied services using the same pattern.In what environment did you encounter the issue?
Additional information you deem important
No response