【发布时间】:2018-07-29 15:00:59
【问题描述】:
在我的 Web 服务器和 Docker 应用程序前面,我运行 Traefik 来处理负载平衡和反向代理。在这种特定情况下,Magento 2 运行在与 Traefik 主机相同的专用网络中的另一台主机上。
- Traefik:192.168.1.30
- Magento:192.168.1.224
流量通过端口 80/443 进入防火墙并转发到 Traefik,后者根据域名(在本例中为 exampleshop.com)转发请求。
我的 Traefik 配置如下所示:
[entryPoints]
[entryPoints.http]
address = ":80"
[entryPoints.http.redirect]
entryPoint = "https"
[entryPoints.https]
address = ":443"
[entryPoints.https.tls]
[backends]
[backends.backend-exampleshop]
[backends.backend-exampleshop.servers.server1]
url = "http://192.168.1.224:80
passHostHeader = true
[frontends]
[frontends.exampleshop]
backend = "backend-exampleshop"
[frontends.exampleshop.routes.hostname]
rule = "Host:exampleshop.com"
对于常规网站,上述配置始终按预期工作(具有有效 Let's Encrypt 证书的有效 HTTPS 连接),但在 Magento 2 的情况下,它会导致:
ERR_TOO_MANY_REDIRECTS
因此,我无法同时访问我的主页和管理页面。查看数据库记录,我将我的不安全 URL 都配置为 https://exampleshop.com 以避免重定向错误。
Apache 在端口 80 上监听良好,当直接联系(通过更改我的主机文件)时,页面通过 HTTP 显示得很好。
我在这里错过了什么?
【问题讨论】:
标签: apache docker reverse-proxy magento2 traefik