我试图使用Apache2作为反向代理来访问在Docker容器中运行的应用程序(口径web)。由于应用程序使用重定向(更详细的这里),所以我尝试使用apache的国防部_替身修改重定向中的URL,使它们指向正确的URL。我在一个名为calibreweb.conf的文件中编写了以下内容,并启用了站点和substitute模块。
<Location /calibre-web>
ProxyPass http://127.0.0.1:8083
ProxyPassReverse http://127.0.0.1:8083
AddOutputFilterByType SUBSTITUTE text/html
Substitute "s|https://subdomain.example.com/|https://subdomain.example.com/calibre-web/|i"
</Location>问题是,在重新启动Apache之后,国防部没有做任何事情。作为正常检查,我尝试将替代模式更改为Substitute "s|admin|user|i",因为第一个重定向包含admin,但仍然被重定向到subdomain.example.com/admin/dbconfig。将SetOutputFilter SUBSTITUTE,DEFLATE添加到AddOutputFilterByType行的上方没有帮助。还移除内容类型筛选器,使文件变为
<Location /calibre-web>
ProxyPass http://127.0.0.1:8083
ProxyPassReverse http://127.0.0.1:8083
Substitute "s|https://nas.gtpware.eu/|https://nas.gtpware.eu/calibre-web/|i"
</Location>没能治好。知道为什么这不管用吗?它看起来就像Apache2 2‘S文档中给我的例子。谢谢你的帮助,
GTP95
发布于 2023-03-24 10:35:24
事实证明,在他们的wiki 这里中有一个有效的例子。归根结底是:
<Location /calibre-web >
RequestHeader set X-SCRIPT-NAME /calibre-web
RequestHeader set X-SCHEME https
ProxyPass http://localhost:8083/
ProxyPassReverse http://localhost:8083/
ProxyPassReverseCookiePath / /calibre-web/
</Location>https://serverfault.com/questions/1126975
复制相似问题