2024-12-02

deliver http and https


Today I tested my website on some old devices (e.g. iPad from 2011) and they can not connect via HTTPS. These lovely older machines simply can't do it because of the encryption, unknown CAs and stuff that protects our fast spinning digital world. So I decided to deliver my website via HTTPS and HTTP.

I use docker-compose on my host machine and set up lets-encrypt and traefik for automatic certificate generation.

To support HTTP as well I just removed the redirect from HTTP to HTTPS and connect both entrypoints with the backend.

before

services:

traefik:
image: "traefik:v2.3"
command:
...
- "--entrypoints.web.address=:80"
- "--entrypoints.web.http.redirections.entryPoint.to=websecure"
- "--entrypoints.web.http.redirections.entryPoint.scheme=https"
- "--entrypoints.websecure.address=:443"
...

web:
image: caddy:2.3.0-alpine
labels:
...
- "traefik.http.routers.caddy.rule=(Host(`kr1sp1n.io`))"
- "traefik.http.routers.caddy.entrypoints=websecure"
- "traefik.http.routers.caddy.tls.certresolver=resolver"
...


after

services:

traefik:
image: "traefik:v2.3"
command:
...
# Remove redirects from http to https:
#- "--entrypoints.web.http.redirections.entryPoint.to=websecure"
#- "--entrypoints.web.http.redirections.entryPoint.scheme=https"
...

web:
image: caddy:2.3.0-alpine
labels:
...
# HTTP entrypoint:
- "traefik.http.routers.caddy.entrypoints=web"
- "traefik.http.routers.caddy.rule=(Host(`kr1sp1n.io`))"
# HTTPS entrypoint
- "traefik.http.routers.caddysecure.entrypoints=websecure"
- "traefik.http.routers.caddysecure.rule=(Host(`kr1sp1n.io`))"
...


And thanks to this little change your devices can now connect to:
Hooray!