使用反向代理时 Magento 前端重定向错误

Magento frontend redirect error while using reverse proxy

我们一直在努力解决涉及 Magento 网站和反向代理的问题。

服务器 A 用作反向代理 (apache) 并将传入的 subdomain.domain.com/appname 重定向到 local-ip/appname 托管在服务器 B 上(还有 Apache)。

真正奇怪的是后端一切正常。我们可以登录,修改东西,一切都非常正常。

但在前端没有任何效果,并且存在无限重定向。

然而,使用 local-ip/appname 作为基础 url 设置 Magento,并通过 subdomain.domain 访问它。com/appname(不包括 local-ip/appname) 如果从本地网络访问则工作正常。

一旦 Magento 使用地址 subdomain.domain.com/appname 作为基础 url,前端就会出现无限重定向错误。

如果有人对此有任何意见,我们将不胜感激。

谢谢!

郑重声明,反向代理需要指令

ProxyPreserveHost On

由于它默认设置为关闭,因此存在无限重定向,因为 Magento 试图访问外部地址,该地址被反向代理等转换为本地 ip。 使用 ProxyPreserveHost On 反向代理将原始 url 传输到他背后的网站。因此,可以将 Magento 设置为以外部地址为基础 url.