CakePHP 中的反向代理?
我有一个 CakePHP 应用程序,并且在我的 httpd.conf 中包含以下指令
ProxyRequests off
ProxyPass /forum/ http://somesite.com/phpbb3
ProxyPass /gallery/ http://someothersite.com/gallery3
<Location /forum/>
ProxyPassReverse /
</Location>
<Location /gallery/>
ProxyPassReverse /
</Location>
如果没有 CakePHP,这可以正常工作 - 但因为 CakePHP 使用它自己的来自 paths.php 和其他来源的重定向逻辑,它似乎会覆盖任何代理设置,因此任何对我的服务器上的“/community”的调用遵循寻找名为 CommunityController 的控制器的默认路径。
我的问题是,我希望拥有一台服务于多个应用程序的服务器,但要保持对用户的无缝连接 - 因此完整的 PHPBB 应用程序可以在“/forum”目录中运行,就好像它是 CakePHP 中的控制器一样。
以前有人这样做过吗?可以吗?为什么 mod_rewrite
和/或routes.php 文件会覆盖我的mod_proxy
指令?
I've got a CakePHP application, and the following directives in my httpd.conf
ProxyRequests off
ProxyPass /forum/ http://somesite.com/phpbb3
ProxyPass /gallery/ http://someothersite.com/gallery3
<Location /forum/>
ProxyPassReverse /
</Location>
<Location /gallery/>
ProxyPassReverse /
</Location>
Without CakePHP this works fine - but because CakePHP is using it's own redirection logic from routes.php and other sources, it seems to override any proxy settings, so any call to "/community" on my server follows the default pathway of looking for a Controller called CommunityController.
My issue here is that I want to have one server that serves muliple applications, but keep it seamless to the user - so a complete PHPBB application can for instance run within the "/forum" directory as if it were a controller in CakePHP.
Has anyone done this before, and can it be done? Why does mod_rewrite
and/or the routes.php file override my mod_proxy
directives??
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
也许您可以使用 mod_rewrite 来创建 RewriteRule,而不是使用 mod_proxy 指令,带有
[P]
(代理)标志和[L]
(最后一条规则)标志。'proxy|P'(强制代理):
'last|L'(最后一条规则):
Perhaps instead of using mod_proxy, you could use mod_rewrite to create a RewriteRule directive with the
[P]
(proxy) flag in conjunction with the[L]
(last rule) flag.'proxy|P' (force proxy):
'last|L' (last rule):