https://www 上的 Traefik 404
Traefik 404 on https://www
我正在使用这个配置:
version: "3.3"
services:
traefik:
command:
# Get Docker as the provider
- "--providers.docker=true"
# Avoid that all containers are exposed
- "--providers.docker.exposedbydefault=false"
# Settle the ports for the entry points
- "--entrypoints.web.address=:80"
- "--entrypoints.web-secure.address=:443"
# Settle the autentification method to http challenge
- "--certificatesresolvers.myhttpchallenge.acme.httpchallenge=true"
- "--certificatesresolvers.myhttpchallenge.acme.httpchallenge.entrypoint=web"
# Uncomment this to get a fake certificate when testing
#- "--certificatesresolvers.myhttpchallenge.acme.caserver=https://acme-staging-v02.api.letsencrypt.org/directory"
# Settle letsencrypt as the certificate provider
- "--certificatesresolvers.myhttpchallenge.acme.email=___________________
- "--certificatesresolvers.myhttpchallenge.acme.storage=/letsencrypt/acme.json"
mysite:
labels:
# The labels are usefull for Traefik only
- "traefik.enable=true"
- "traefik.docker.network=traefik"
# Get the routes from http
- "traefik.http.routers.mysite.rule=Host(mysite.com, www.mysite.com)"
- "traefik.http.routers.mysite.entrypoints=web"
# Redirect these routes to https
- "traefik.http.middlewares.redirect-to-https.redirectscheme.scheme=https"
- "traefik.http.routers.mysite.middlewares=redirect-to-https@docker"
# Get the routes from https
- "traefik.http.routers.mysite-secured.rule=Host(mysite.com, www.mysite.com)"
- "traefik.http.routers.mysite-secured.entrypoints=web-secure"
# Apply autentificiation with http challenge
- "traefik.http.routers.mysite-secured.tls=true"
- "traefik.http.routers.mysite-secured.tls.certresolver=myhttpchallenge"
除 https://www 外一切正常。我收到 SSL 错误,然后当我仍然单击继续时,我收到来自 traefik 的错误,404 页面未找到。 http://、https://、http://www 都有效,重定向到 https://。但是 https://www 不起作用。
我尝试了很多建议,regex 中间件都没有成功。这只是完全相同的结果。
我需要在 Host() 中的站点名称周围添加反引号:
- "traefik.http.routers.mysite.rule=Host(`mysite.com`, `www.mysite.com`)"
- "traefik.http.routers.mysite-secured.rule=Host(`mysite.com`, `www.mysite.com`)"
另外,我的部署是错误的。有时我会临时上传文件,然后手动 运行 一个 post-receive 挂钩,它会覆盖旧版本。
我正在使用这个配置:
version: "3.3"
services:
traefik:
command:
# Get Docker as the provider
- "--providers.docker=true"
# Avoid that all containers are exposed
- "--providers.docker.exposedbydefault=false"
# Settle the ports for the entry points
- "--entrypoints.web.address=:80"
- "--entrypoints.web-secure.address=:443"
# Settle the autentification method to http challenge
- "--certificatesresolvers.myhttpchallenge.acme.httpchallenge=true"
- "--certificatesresolvers.myhttpchallenge.acme.httpchallenge.entrypoint=web"
# Uncomment this to get a fake certificate when testing
#- "--certificatesresolvers.myhttpchallenge.acme.caserver=https://acme-staging-v02.api.letsencrypt.org/directory"
# Settle letsencrypt as the certificate provider
- "--certificatesresolvers.myhttpchallenge.acme.email=___________________
- "--certificatesresolvers.myhttpchallenge.acme.storage=/letsencrypt/acme.json"
mysite:
labels:
# The labels are usefull for Traefik only
- "traefik.enable=true"
- "traefik.docker.network=traefik"
# Get the routes from http
- "traefik.http.routers.mysite.rule=Host(mysite.com, www.mysite.com)"
- "traefik.http.routers.mysite.entrypoints=web"
# Redirect these routes to https
- "traefik.http.middlewares.redirect-to-https.redirectscheme.scheme=https"
- "traefik.http.routers.mysite.middlewares=redirect-to-https@docker"
# Get the routes from https
- "traefik.http.routers.mysite-secured.rule=Host(mysite.com, www.mysite.com)"
- "traefik.http.routers.mysite-secured.entrypoints=web-secure"
# Apply autentificiation with http challenge
- "traefik.http.routers.mysite-secured.tls=true"
- "traefik.http.routers.mysite-secured.tls.certresolver=myhttpchallenge"
除 https://www 外一切正常。我收到 SSL 错误,然后当我仍然单击继续时,我收到来自 traefik 的错误,404 页面未找到。 http://、https://、http://www 都有效,重定向到 https://。但是 https://www 不起作用。
我尝试了很多建议,regex 中间件都没有成功。这只是完全相同的结果。
我需要在 Host() 中的站点名称周围添加反引号:
- "traefik.http.routers.mysite.rule=Host(`mysite.com`, `www.mysite.com`)"
- "traefik.http.routers.mysite-secured.rule=Host(`mysite.com`, `www.mysite.com`)"
另外,我的部署是错误的。有时我会临时上传文件,然后手动 运行 一个 post-receive 挂钩,它会覆盖旧版本。