http: routers: # Redirect HTTP→HTTPS only for public domains (not .local or private IPs) http_redirect: rule: "HostRegexp(`{host:.+}`) && !HostRegexp(`{local:.+\\.local}`) && !HostRegexp(`{ip:192\\.168\\..+}`) && !HostRegexp(`{ip2:10\\..+}`) && !HostRegexp(`{ip3:172\\.(1[6-9]|2[0-9]|3[01])\\..+}`) && !HostRegexp(`{relay:.+\\.waouw\\.tech}`)" entryPoints: - web middlewares: - redirect_to_https service: noop@internal priority: 9999 # Local access: serve backend API over HTTP (no TLS) backend_local: rule: "(HostRegexp(`{local:.+\\.local}`) || HostRegexp(`{ip:192\\.168\\..+}`) || HostRegexp(`{ip2:10\\..+}`)) && PathPrefix(`/api`)" entryPoints: - web service: backend_static priority: 5000 # Local access: serve frontend over HTTP (no TLS) frontend_local: rule: "HostRegexp(`{local:.+\\.local}`) || HostRegexp(`{ip:192\\.168\\..+}`) || HostRegexp(`{ip2:10\\..+}`)" entryPoints: - web service: frontend_static priority: 2 # Relay tunnel: accept HTTP from WireGuard (10.100.x.x) without redirect # The relay terminates TLS, so the boîtier receives plain HTTP via the tunnel relay_backend: rule: "HostRegexp(`{host:.+\\.waouw\\.tech}`) && PathPrefix(`/api`)" entryPoints: - web service: backend_static priority: 6000 relay_nextcloud: rule: "HostRegexp(`{host:cloud-.+\\.waouw\\.tech}`)" entryPoints: - web service: nextcloud_static priority: 5500 # Relay: WaouW frontend for *.waouw.tech that don't match a site container relay_frontend: rule: "HostRegexp(`{host:.+\\.waouw\\.tech}`)" entryPoints: - web service: frontend_static priority: 3 backend_static: rule: "PathPrefix(`/api`)" entryPoints: - websecure tls: {} service: backend_static priority: 1000 frontend_static: rule: "PathPrefix(`/`)" entryPoints: - websecure tls: {} service: frontend_static priority: 1 services: backend_static: loadBalancer: servers: - url: "http://waouw_backend:8000" frontend_static: loadBalancer: servers: - url: "http://waouw_frontend:80" nextcloud_static: loadBalancer: servers: - url: "http://waouw_nextcloud:80" middlewares: redirect_to_https: redirectScheme: scheme: https permanent: true # Alias with dashes (referenced by site containers) # In relay mode, this must NOT redirect because the relay already handles TLS # Using headers middleware instead of redirect to make it a no-op redirect-to-https: headers: customResponseHeaders: X-Forwarded-Proto: "https"