URL 匹配多个位置。如何仅从第一个位置执行指令?
我们在 Apache httpd.conf 中有以下配置:
<Location /app/srv>
...
ProxyPass http://localhost:123/srv
ProxyPassReverse http://localhost:123/srv
Header edit Set-Cookie JSESSIONID srv.${ENV}.JSESSIONID
RequestHeader edit Cookie srv.${ENV}.JSESSIONID JSESSIONID
</Location>
#Following instructions do not work!
#ProxyPass /app/srv !
#ProxyPass /app !
<Location /app >
...
ProxyPass http://localhost:123/app
ProxyPassReverse http://localhost:123/app
Header edit Set-Cookie JSESSIONID app.${ENV}.JSESSIONID
RequestHeader edit Cookie app.${ENV}.JSESSIONID JSESSIONID
</Location>
据我所知,如果请求上下文路径 /app/srv coockie JSESSIONID 将被编辑两次。
结果将被重命名为 srv.${ENV}.app.${ENV}.JSESSIONID
但我需要将 coockie 重命名为 srv.${ENV}.JSESSIONID >
我可以在我们的测试盒上看到这种行为。
是否可以在“Location /app/srv”指令之后停止处理?
我尝试在指令“Location /app/srv”后添加指令“ProxyPass /app/srv !”,但没有帮助。
更新:
我不知道 /app 的完整上下文路径是什么。
可能是 /app/page1、/app/page2 等
我只知道存在 /app/srv 和 /app/something 上下文路径。
我希望对 /app/srv 和 /app/something 上下文路径有不同的说明。
We have following configuration in Apache httpd.conf:
<Location /app/srv>
...
ProxyPass http://localhost:123/srv
ProxyPassReverse http://localhost:123/srv
Header edit Set-Cookie JSESSIONID srv.${ENV}.JSESSIONID
RequestHeader edit Cookie srv.${ENV}.JSESSIONID JSESSIONID
</Location>
#Following instructions do not work!
#ProxyPass /app/srv !
#ProxyPass /app !
<Location /app >
...
ProxyPass http://localhost:123/app
ProxyPassReverse http://localhost:123/app
Header edit Set-Cookie JSESSIONID app.${ENV}.JSESSIONID
RequestHeader edit Cookie app.${ENV}.JSESSIONID JSESSIONID
</Location>
As far as I can see in case of request with context path /app/srv coockie JSESSIONID will be edited two times.
And in result will be renamed to srv.${ENV}.app.${ENV}.JSESSIONID
But I need to rename coockie to srv.${ENV}.JSESSIONID
I can see such behavior on one our testing box.
Is it possible to stop processing after "Location /app/srv" directive?
I tried to add instruction "ProxyPass /app/srv !" after directive "Location /app/srv" but it does not help.
UPDATE:
I do not know what full context path could be for /app.
It could be /app/page1, /app/page2, etc.
I only know that there exist /app/srv and /app/something context paths.
And I would like to have different instructions for /app/srv and /app/something context paths.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您应该能够使用 LocationMatch 来获得您想要的内容this:
应该匹配 /app 和 /app/,但不匹配 /app/srv。
You should be able to use LocationMatch to get what you want like this:
That should match /app and /app/ but not /app/srv.