This Docker container acts as a thin reverse proxy layer for adding common HTTP headers, SSL endpoint termination and optionally basic auth so that your application does not need to implement common functionality.
The configuration for this container is provided via environment variables at start-time:
PROXY_TARGETTarget address and possibly port of upstream- (optional)
PROXY_PROTOCOLProtocol to use when proxying to upstream (default to http) - (optional)
PROXY_HOSTNAMEHostname to present to upstream - (optional)
PORTSpecify port on which nginx will listen (defaults to 80 or 443 when SSL is enabled) - (optional)
SERVER_NAMEFor nginx to listen to - (optional)
NAMESERVERImportant: If not specified nameserver will fallback to127.0.0.11for Docker usage - (optional)
ENABLED_HTTPS_REDIRECTForce 301 redirects to HTTPS. For use where this gateway is used behind another SSL termination endpoint. - (optional)
ENABLED_HTTPS_REDIRECT_ON_PORTCreates an additional HTTP listener/server on given port (recommendation: 80). This listener does nothing more then redirecting to https. - (optional)
CLIENT_MAX_BODY_SIZEDefaults to25Mif not specified - (optional)
CONTENT_SECURITY_POLICYAdds a CSP header - (optional)
CONTENT_SECURITY_POLICY_REPORT_ONLYAdds a CSP reporting header - (optional)
CORS_POLICY_ORIGINAdds origin CORS header and other configured CORS headers to response - (optional)
CORS_POLICY_METHODSDefaults to safe methodsGETandHEAD- only applicable whenCORS_POLICY_ORIGINis set - (optional)
CORS_POLICY_ALLOW_CREDENTIALS- Only valid value isyes. Otherwise header will be omitted. Only applicable whenCORS_POLICY_ORIGINis set - (optional)
CORS_POLICY_ALLOW_HEADERS- only applicable whenCORS_POLICY_ORIGINis set - (optional)
CORS_POLICY_EXPOSE_HEADERS- only applicable whenCORS_POLICY_ORIGINis set - (optional)
BASIC_AUTHIf you need basic auth protection add " " combinations for every user separated by semicolon
This reverse proxy can also handle SSL endpoint termination.
- (optional)
SSL_CERTIFICATESpecify the path to the SSL certificate within the container. - (optional)
SSL_CERTIFICATE_KEY
If you have OpenSSL installed run the following command to generate your private key and certificate for development purposes:
openssl req -x509 -nodes -days 365 -newkey rsa:2048 -subj "/CN=localhost" -addext "subjectAltName = IP:127.0.0.1" -keyout selfsigned.key -out selfsigned.crt
If you have OpenSSL installed run the following commands to generate a certificate for development purposes:
# Generate your own CA
openssl genrsa -out local-ca.key 4096
openssl req -new -x509 -days 3650 -key local-ca.key -out local-ca.crt -subj "/CN=localhost" -addext "subjectAltName = IP:127.0.0.1"
# Create a client keypair. Performed this once for each user.
openssl genrsa -out client-user.key 2048
openssl req -new -key client-user.key -out client-user.csr -subj "/CN=localhost" -addext "subjectAltName = IP:127.0.0.1"
# Sign CSR with CA key
## Increment the serial to reissue the certificate
openssl x509 -req -days 365 -in client-user.csr -CA local-ca.crt -CAkey local-ca.key -set_serial 01 -out client-user.crt