2MB HTTP to HTTPS redirect Docker microservice
I have released an ultra small 2MB HTTP to HTTPS / httpsredirect microservice which is available on Docker Hub at https://hub.docker.com/r/q4uw/httpredirector/.
The Docker image has several advantages to the existing httpsredirect images on Docker hub.
- It is ultra small at 2MB
- It allows both HTTPS and WWW canonical name redirection
- It allows hostname redirect restriction preventing 3rd parties from using you as a redirect service.
The existing redirection images on Dockerhub allow anyone to use your server as a redirection service. This is true of geldim/https-redirect which has 500K+ pulls and camptocamp/https-redirect which has 10k+ pulls.
docker run --rm -ti \ -e FORCE_SSL=TRUE \ -e FORCE_WWW=TRUE \ -p 80:8080 \ q4uw/httpredirector:0.0.2
Verify it is working:
curl -I localhost HTTP/1.1 307 Temporary Redirect Date: Sat, 10 Dec 2016 07:19:01 GMT Server: Warp/3.2.9 Location: https://www.localhost/
Full instructions and source code
Full instructions are available on the Docker hub page https://hub.docker.com/r/q4uw/httpredirector/.
The Github repository and source code is at https://github.com/ajevans85/httpredirector.
Note for Google Cloud
If you plan to use this image on Google Cloud please see https://stackoverflow.com/questions/41181496/google-cloud-mixed-http-https-application-load-balancing/ for configuring a cloud load balancer to use the redirection service which I originally developed this image for.