Replace nginx with Caddy for TLS termination and reverse proxying.

- Replace nginx with Caddy as the web server for both Docker and native
  (RPi/Debian) deployments. Caddy handles HTTPS termination, reverse
  proxying to all services (API, React app, Controller, Kiwix, Help, Map),
  and serves the media/download file browsers.
- Generate a Root CA and signed leaf certificates for HTTPS. The Root CA
  uses Name Constraints to restrict signing to local addresses only
  (.local, localhost, and RFC 1918 private IP ranges), mitigating MITM
  risk if the CA key is compromised.
- Add an HTTP landing page that guides users through one-time CA
  certificate installation on iOS, Android, macOS, Windows, Linux, and
  Firefox, with auto-redirect when the cert is already trusted.
- Add trailing-slash redirects for /controller, /docs, /media, and
  /download so bare paths don't fall through to the React catch-all.
- Add a Root CA download link on the Settings page under Configs.
- Update help.sh diagnostics for IPv6 listener detection and HTTP/2
  status codes.
- Remove all nginx config files and the https_proxy Docker container.
- Bump wrolpi-help submodule with certificate documentation.
This commit is contained in:
Roland 2026-03-07 12:08:27 -07:00 • committed by lrnselfreliance
parent dd270b37dc
commit fbb71e012d
43 changed files with 881 additions and 583 deletions

View file

@ -102,7 +102,7 @@ services:
interval: 1m
user: '${UID-1000}:${GID-1000}'
environment:
# Force React to use nginx port to connect to it's websocket.
# Force React to use Caddy port to connect to it's websocket.
- WDS_SOCKET_PORT=0
map: # https://github.com/Overv/openstreetmap-tile-server
@ -119,39 +119,33 @@ services:
test: [ 'CMD-SHELL', 'curl http://127.0.0.1:80' ]
interval: 1m
map_https: # HTTPS for map tile server
depends_on:
- map
environment:
- UPSTREAM_HOST=map
build:
context: .
dockerfile: docker/https_proxy/Dockerfile
ports:
- '8084:443'
volumes:
- './docker/map/nginx.map.conf:/etc/nginx/nginx.conf'
healthcheck:
test: [ 'CMD-SHELL', 'curl http://127.0.0.1:443' ]
interval: 1m
web:
web: # Caddy reverse proxy - handles HTTPS for all services.
depends_on:
- app
- zim
- help
- map
build:
context: .
dockerfile: docker/web/Dockerfile
ports:
- ${WEB_HOST-0.0.0.0}:${WEB_PORT-8080}:80
- ${WEB_HOST-0.0.0.0}:${WEB_HTTPS_PORT-8443}:443
- '8084:8084'
- '8085:8085'
- '8086:8086'
volumes:
- './docker/web/nginx.dev.conf:/etc/nginx/nginx.conf'
- './docker/web/wrolpi.dev.conf:/etc/nginx/conf.d/wrolpi.conf'
- './icon.ico:/etc/nginx/favicon.ico'
- './icon.png:/etc/nginx/icon.png'
- './docker/web/Caddyfile:/etc/caddy/Caddyfile'
- './icon.ico:/etc/caddy/favicon.ico'
- './icon.png:/etc/caddy/icon.png'
- './test:/opt/media'
environment:
- MEDIA_DIRECTORY=/opt/media
# Set EXTRA_SANS to include the host's LAN IP in the TLS certificate.
# Example: EXTRA_SANS=IP:10.0.0.5
- EXTRA_SANS=${EXTRA_SANS:-}
healthcheck:
test: [ 'CMD-SHELL', 'curl http://127.0.0.1:80' ]
test: [ 'CMD-SHELL', 'wget --spider http://127.0.0.1:80 || exit 1' ]
interval: 1m
zim: # kiwix-serve
@ -165,22 +159,6 @@ services:
test: [ 'CMD-SHELL', 'curl http://127.0.0.1:80' ]
interval: 1m
zim_https: # HTTPS for Zim service.
depends_on:
- zim
environment:
- UPSTREAM_HOST=zim
build:
context: .
dockerfile: docker/https_proxy/Dockerfile
ports:
- '8085:443'
volumes:
- './docker/zim/nginx.zim.conf:/etc/nginx/nginx.conf'
healthcheck:
test: [ 'CMD-SHELL', 'curl http://127.0.0.1:443' ]
interval: 1m
help: # The WROLPi Help documentation.
build:
context: .
@ -191,22 +169,6 @@ services:
test: [ 'CMD-SHELL', 'curl http://127.0.0.1:8086' ]
interval: 1m
help_https: # HTTPS for Help service.
depends_on:
- help
environment:
- UPSTREAM_HOST=help
build:
context: .
dockerfile: docker/https_proxy/Dockerfile
ports:
- '8086:443'
volumes:
- './docker/help/nginx.help.conf:/etc/nginx/nginx.conf'
healthcheck:
test: [ 'CMD-SHELL', 'curl http://127.0.0.1:443' ]
interval: 1m
volumes:
openstreetmap-data:
external: true