Support for stream module
I wanted to float an idea: support for streaming connections. I put together a quick proof of concept on the stream branch of this fork. Run docker-compose -f docker-compose-separate-containers.yml up -d --build to see connections proxied to both the whoami service and a mongo service. You can grab a mongo admin UI and connect to it using mongo.local:27017.
So, what do people think? Is there a valuable use case for this?
Downsides:
- You can't have different VIRTUAL_HOSTS listening on the same port, since there's no hostname resolution like with HTTP.
Work left:
- Get it working when docker-gen and nginx are running in the same container
- Block http access over the streaming port
- Finish stream.tmpl
- Tests
Would this allow me to run OpenVPN behind nginx-proxy?
I'm very interested in this functionality, but I think this would require deviating from the official nginx docker image. They don't seem to provide the stream modules from the official images.
Yes, it requires building on the official nginx image. You can see the Dockerfile I put together to do that here: https://github.com/sjawhar/nginx-proxy/blob/stream/Dockerfile.nginx
My main concern, as the person who opened this issue and made the fork, is that I'm not sure it's even a good idea to start with. Maybe it's better to just use HAProxy or something.
Also, since you can't have different VIRTUAL_HOSTS on the same port... I'm struggling to remember why I started this. :)
I would find this useful. I'm using the Let's Encrypt companion container to manage SSL certificates for a bunch of HTTP hosts. Now I would like to put my MQTT server behind the proxy and have its certificate renewed automatically.
i think, can split nginx.tmpl in two files:
upstream.tmpl --> upstream.conf
server.tmpl --> default.conf
then, can include upstream.conf in http and stream