A simple, easy-to-configure reverse proxy with optional basic authentication support.
342
reverse-proxy imageA simple, easy-to-configure reverse proxy with optional basic authentication support.
docker pull mrnehu/reverse-proxy
This image builds upon Nginx.
This image is configured through environment variables:
server_name: (mandatory) A name for the serverlocationn_source: (mandatory) The public endpointlocationn_destination: (mandatory) The backend serverlocationn_basicauth: (optional, default: 0) Enable basic authentication (1) or not (0) on this endpoint.locationn_setbaseurl: (optional, default: 0) Force setting the base URL in HTML responses from the upstream server (1) or not (0) on this endpoint.
locationn_returncode: (optional) If set, the destination locationn_destination will be ignored and requests will be answered by the reverse-proxy with the indicated HTTP return code (200 for regular responses).locationn_returnbody: (optional) If locationn_returncode is set, then the locationn_returnbody defines the body of the response; it may also be left empty.usern: (mandatory) The .htpasswd user entryThe image generates its configuration based on the environment variables. Alternatively, it is possible to mount an own nginx.conf file to /etc/nginx/nginx.conf. The container will detect this and will not change the mounted file.
See docker-compose.yml for a usage example.
Basic authentication requires the generation of an .htpasswd file. This can be done with the apache tools (usually available as a separate package).
Generate the .htpasswd file as follows:
htpasswd -B -c .htpasswd username
The -B flag forces the bcrypt algorithm, which is more secure than the default md5 algorithm.
The -c flag indicates that a new file is created (omit to append additional users).
Print out the contents in the docker-compose.yml format, and insert them under the environment section:
cat .htpasswd | sed 's|$|$$|g' | awk "{print \"user\" NR-1 \": '\" \$0 \"'\"}"
The .htpasswd file is no longer needed and can be deleted.
Content type
Image
Digest
Size
9.7 MB
Last updated
about 6 years ago
docker pull mrnehu/reverse-proxy