Public Repository

Last pushed: 2 years ago
Short Description
Auto container decting reverse http/s proxy written in nodeJS
Full Description

#Docker Autoproxy#

git repo https://bitbucket.org/riccagroup/docker-autoproxy

Autoproxy is a quick and simple http and https reverse proxy using nodeJS.
This proxy auto detects running containers configured with environment variables,
and proxies the configured domains to the random ports docker creates.

##Features##

  • Auto detect running containers
  • Reverse proxy domains to containers
  • Supports HTTP and HTTPS
  • Generic Self Signed SSL cert
  • Configuration through Environment variables
  • Written in nodeJS

##Installation##

docker build riccagroup/autoproxy

##Usage##

To run the proxy use the following:

docker run -p 80:80 -p 443:443 -e "HOST_MACHINE"=>"autoproxy.dev" -v /var/run/docker.sock:/var/run/docker.sock riccagroup/autoproxy

When running any container, just add -e AUTO_PROXY_HOSTNAME='example.com' to the run script

Run example:

docker run -p 80 -p 443 -e AUTO_PROXY_HOSTNAME='example.com' example/container

When pointing example.com to the autoproxy container IP or the host server of docker it will proxy http://example.com to http://example.com:autoPort.

###Proxy Environment Configurations###

HOST_MACHINE This is used in the UI when directly accessing the IP of the container or host machine

LOG_LEVEL=info Logging information to show (error, warn, info, debug)

HTTP_PORT=80 Port to start http proxy on

HTTPS_PORT=443 Port to start https proxy on

Environment variable to look for in the container:

ENV_KEY=AUTO_PROXY_HOSTNAME The domain name

ENV_KEY_HTTP_PORT=AUTO_PROXY_HTTP Where to map http to

ENV_KEY_HTTPS_PORT=AUTO_PROXY_HTTPS where to map https to

###Container Environment Variables###

AUTO_PROXY_HOSTNAME Must be set to use the proxy. should be a domain name or IP

You can change the default proxy behavior to look for ports other then 80 and 443. To do this just set the AUTO_PROXY_HTTP and AUTO_PROXY_HTTPS environment variables when running the container.

AUTO_PROXY_HTTP port to look for to map http requests

AUTO_PROXY_HTTPS port to look for to map https requests

####Mailcatcher example####

Say we want to run mailcatcher but want to access it using mailcatcher.dev We would set in out pc host mailcatcher.dev to our docker host machine IP.

then run:

docker run -p 1080 -e AUTO_PROXY_HTTP=1080 -e AUTO_PROXY_HOSTNAME='mailcatcher.dev' zolweb/docker-mailcatcher

when we go to mailcatcher.dev we will now be forwarded to the random port that docker assigns the container.

if we run

docker run -p 1080:1080 -e AUTO_PROXY_HTTP=1080 -e AUTO_PROXY_HOSTNAME='mailcatcher.dev' zolweb/docker-mailcatcher

We will now be able to access mailcatcher using mailcatcher.dev OR port 1080 on our host machine.

##Questions/issues##
Open a ticket on our bitbucket repo.

https://bitbucket.org/riccagroup/docker-autoproxy/issues

Docker Pull Command
Owner
riccagroup

Comments (0)