Redirect HTTP to HTTPS with Docker
1M+
Dockerfile linkslatest (Dockerfile) - 1.2 (Dockerfile) - 1.1 (Dockerfile) - 1.0 (Dockerfile) - This image accepts any http request and redirects to the https version of the same page.
It does not serve any pages.
The primary reason for this image is for doing SSL termination on a load balancer (eg: AWS ELB) in the simplest possible way.
docker run -d -p 8080:80 scottmiller171/go-ssl-redirect
docker run -d -p 80:80 my-web-server-image
All HTTP requests will hit this image and be redirected to make HTTPS request. This is abstracted from the user.
Assuming you have go installed, do the following:
CGO_ENABLED=0 GOOS=linux go build -a -ldflags '-s'
docker build -t go-ssl-redirect .
docker run go-ssl-redirect
I am doing the build outside of a Docker container so that I can reduce the size of the image. The official GoLang container is 725 MB in size. By doing it this way, this entire container is only 5.5MB
Content type
Image
Digest
Size
1.6 MB
Last updated
about 10 years ago
docker pull scottmiller171/go-ssl-redirect