{"id":13551449,"url":"https://github.com/rehabstudio/docker-autoproxy","last_synced_at":"2026-01-11T01:44:47.936Z","repository":{"id":27485598,"uuid":"30965560","full_name":"rehabstudio/docker-autoproxy","owner":"rehabstudio","description":"A simple Go application that runs alongside nginx in a docker container and can automatically configure the server (nginx) to provide reverse proxy functionality for any containers running on the same host.","archived":false,"fork":false,"pushed_at":"2015-04-26T03:35:27.000Z","size":324,"stargazers_count":5,"open_issues_count":0,"forks_count":2,"subscribers_count":9,"default_branch":"master","last_synced_at":"2024-08-01T12:24:52.601Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/rehabstudio.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-02-18T12:56:53.000Z","updated_at":"2019-07-13T17:13:12.000Z","dependencies_parsed_at":"2022-09-02T09:00:29.913Z","dependency_job_id":null,"html_url":"https://github.com/rehabstudio/docker-autoproxy","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rehabstudio%2Fdocker-autoproxy","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rehabstudio%2Fdocker-autoproxy/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rehabstudio%2Fdocker-autoproxy/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rehabstudio%2Fdocker-autoproxy/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rehabstudio","download_url":"https://codeload.github.com/rehabstudio/docker-autoproxy/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":222905951,"owners_count":17055820,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-01T12:01:48.466Z","updated_at":"2026-01-11T01:44:47.894Z","avatar_url":"https://github.com/rehabstudio.png","language":"Go","readme":"![License MIT](https://img.shields.io/badge/license-MIT-blue.svg)\n\ndocker-autoproxy sets up a container running nginx and and a small companion\napplication written in Go. The companion app generates reverse proxy\nconfigurations for nginx and reloads nginx when containers are started and\nstopped.\n\nThis project is heavily inspired by (and lifts part of this README from)\n[nginx-proxy](https://github.com/jwilder/nginx-proxy) but has a slightly\ndifferent (much smaller) feature set. nginx-proxy is a much more generic\nsolution and if docker-autoproxy doesn't meet your needs you should definitely\ncheck it out.\n\n\n### Usage\n\nTo run it:\n\n```bash\n$ docker run -d -p 80:80 -p 443:443 -v /var/run/docker.sock:/var/run/docker.sock rehabstudio/autoproxy\n```\n\nThen start any containers you want proxied with an env var\n`VIRTUAL_HOST=subdomain.youdomain.com`\n\n```bash\n$ docker run -e VIRTUAL_HOST=foo.bar.com  ...\n```\n\nProvided your DNS is setup to forward foo.bar.com to the a host running\n`docker-autoproxy`, the request will be routed to a container with the\nVIRTUAL_HOST env var set.\n\n\n### Multiple Ports\n\nIf your container exposes multiple ports, you need to specify a which port\nshould be used. You can set a VIRTUAL_PORT env var to select the correct port.\nIf your container only exposes one port and it has a VIRTUAL_HOST env var set,\nthat port will be selected automatically.\n\n```bash\n$ docker run -e VIRTUAL_HOST=foo.bar.com -e VIRTUAL_PORT=80 nginx:latest\n```\n\n### Wildcard Hosts\n\nYou can also use wildcards at the beginning and the end of host name, like\n`*.bar.com` or `foo.bar.*`. Or even a regular expression, which can be very\nuseful in conjunction with a wildcard DNS service like [xip.io](http://xip.io),\nusing `~^foo\\.bar\\..*\\.xip\\.io` will match `foo.bar.127.0.0.1.xip.io`,\n`foo.bar.10.0.2.2.xip.io` and all other given IPs. More information about this\ntopic can be found in the\n[nginx documentation](http://nginx.org/en/docs/http/server_names.html).\n\n\n### SSL Support\n\nSSL is supported using single host, wildcard and SNI certificates by specifying\na cert name as the environment variable `SSL_CERT_NAME`.\n\nTo enable SSL:\n\n```bash\n$ docker run -d -p 80:80 -p 443:443 -v /path/to/certs:/etc/nginx/ssl.d -v /var/run/docker.sock:/tmp/docker.sock rehabstudio/autoproxy\n```\n\nThe contents of `/path/to/certs` should contain the certificates and private\nkeys for any virtual hosts in use.  The certificate and keys should be named\nafter the `SSL_CERT_NAME` env var with a `.crt` and `.key` extension.  For\nexample, a container with `SSL_CERT_NAME=foobar` should have a `foobar.crt` and\n`foobar.key` file in the certs directory.\n\n\n### Basic Authentication Support\n\n`docker-autoproxy` supports HTTP basic authentication using the standard\napache/nginx htpasswd format. Users should pass a JSON encoded array of\nusername/password pairs using the `HTPASSWD` environment variable to each\ncontainer that should be secured.\n\n```bash\n$ docker run -e \"HTPASSWD=[\\\"auser:$apr1$SFAk1m9U...\\\", \\\"anotheruser:$apr1$7uFp./y...\\\"]\" ...\n```\n\nThe format of this variable is a bit awkward, but is much easier to manage\nusing other tools (like fig, or oneill) than the docker CLI directly. To\ngenerate a password in the appropriate format you can follow these\n[instructions](http://httpd.apache.org/docs/2.2/programs/htpasswd.html).\n\n\n### Identifying a running container\n\nEvery request served by `autoproxy` has a HTTP header inserted into its\nresponse that can be used to identify the Docker image that was used to serve\nit. Clients can inspect the `X-Autoproxy` header on any HTTP response which\nwill contain the ID of the Docker Image in use.\n\n\n### Building autoproxy locally\n\nIf you're planning to customise autoproxy, whether to submit a patch or just to\ncustomise a private build, the easiest way to do so is to clone this repo\nlocally, build a private copy and push to a docker registry.\n\nThis repository contains a simple build script that depends only on Docker and\nBash. The application is built in multiple steps, using several containers\nthroughout the process. First the Go application is tested and built inside a\ndocker container, upon completion the newly built binary is saved to the\ncurrent folder on the host system. Next, the application binary and\nconfiguration template are installed in a new container alongside the latest\nversion of nginx to produce the final docker-autoproxy build.\n\n```bash\n$ ./build.sh\n```\n\nSome of the reasons you may want to use a custom build are:\n\n- To bake your SSL certificates into the image so that you're not relying on\n  mounting a host volume at runtime.\n- Modifying the nginx configuration template to provide different behavior.\n","funding_links":[],"categories":["Go","others"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frehabstudio%2Fdocker-autoproxy","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frehabstudio%2Fdocker-autoproxy","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frehabstudio%2Fdocker-autoproxy/lists"}