The LISTEN_PORT_HTTP and LISTEN_PORT_HTTPS env variables can now be specified
on web-service containers in order to cause the proxy to listen on the
specified ports. If you only want to allow listening on a port with SSL, these
variables can be set to the value "None" which causes them to not be used. So,
for example, you could set LISTEN_PORT_HTTP=None in order to only proxy traffic
over a secure link. If one or both of these env vars are omitted, the default
values of 80 and 443 will be used where omitted. NOTE: these ports are
internal ports on the container. If you set LISTEN_PORT_HTTPS=1234, and want
to make this accessible on the WAN at port 5555, then you will do something
like
docker run -p 5555:1234 ...
Additionally, on the proxy container, a CUSTOM_TEMPLATE env variable can be
specified, which will instruct docker-gen to use the specified template instead
of the default template. For example, if CUSTOM_TEMPLATE=/app/mytemplate, then
you will want to either copy your template to the container with 'docker cp',
or mount it from the host filesystem with something like
docker run -v /host/path:/app/mytemplate ...
includeSubdomains can lead to issues where not all subdomains are
able to use HTTPS. This options might be too strict for the general
case: https://www.owasp.org/index.php/HTTP_Strict_Transport_Security.
It can be re-enabled w/ a custom template if needed.
Fixes#109
As per RFC4329, nginx uses application/javascript as the default MIME
type for .js files. Nginx-proxy will now gzip these files if the client
requests it.
Looks like it was not actually working before and failing silently
because ssl_trusted_certificate was not specified. Will need to
revisit implementing this functionality so removing it for now
to prevent the warnings logged by nginx now.
This adds SSL support for containers. It supports single host
certificates, wildcards and SNI using naming conventions for
certificates or optionally specify a cert name (for SNI). The SSL
cipher configuration is based on mozilla intermediate profile which
should provide compatibility with clients back to Firefox 1, Chrome 1,
IE 7, Opera 5, Safari 1, Windows XP IE8, Android 2.3, Java 7. The
configuration also enables OCSP stapling, HSTS, and ssl session caches.
To enable SSL, nginx-proxy should be started w/ -p 443:443 and -v
/path/to/certs:/etc/nginx/certs. Certificates must be named:
<virtualhost>.crt and <virtualhost>.key where <virtualhost> matches
the a value of VIRTUAL_HOST on a container.
For wildcard certificates, the certificate and private key should be
named after the wildcard domain with .crt and .key suffixes. For example,
*.example.com should be name example.com.crt and example.com.key.
For SNI where a certificate may be used for multiple domain names, the
container can specify a CERT_NAME env var that corresponds to the base
file name of the certificate and key. For example, if you have a cert
allowing *.example.com and *.bar.com, it can be name shared.crt and
shared.key. A container can use that cert by having CERT_NAME=shared and
VIRTUAL_HOST=foo.example.com. The name "shared" is arbitrary and can
be whatever makes sense.
The behavior for the proxy when port 80 and 443 is defined is as
follows:
* If a container has a usable cert, port 80 will redirect to
443 for that container to always prefer HTTPS when available.
* If the container does not have a usable cert 503 will be returned.
In the last case, a self-signed or generic cert can be defined as
"default.crt" and "default.key" which will allow a client browser to
at least make a SSL connection.