Welcome! Log In Create A New Profile


Container-to-container proxying with NGINX for Docker

Posted by Carl T. 
Container-to-container proxying with NGINX for Docker
July 30, 2020 12:59PM
I would like NGINX to allow the following non-standard proxy address for the proxy_pass directive.


Here's why. When NGINX is running in a Docker container it would be cool if it could proxy to neighboring Docker containers directly.

For example, if MyCoolWebApp is the name of a container its DNS name (internally) will also be MyCoolWebApp and it will be able to be accessed (internally) by another container at http://MyCoolWebApp.

Note: Both containers must be on the same user-defined network (Docker's built-in default network doesn't have DNS enabled, I think).

If that other container is an NGINX reverse proxy I would love if it could do this...

server {
location /somevalue/ {
proxy_pass http://; # <- http:// is currently invalid and produces a startup error

Then, quite simply (in theory), an NGINX container could serve as a reverse proxy for other containers.

Orig URL: http://myreverseproxy/somevalue/MyCoolWebApp
Proxy URL: http://MyCoolWebApp


Carl T.

Edited 1 time(s). Last edit at 07/30/2020 01:02PM by Carl T..
Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 114
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 500 on July 15, 2024
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready