apache代理请求到多个不同的子域
我在domain1.com 有一个网络应用程序,它需要能够向许多不同的站点发出请求,太多而无法为每个站点添加特定的虚拟主机信息,我希望能够做的是通过网络发出请求像这样将应用程序发送到其托管 apache 服务器
/domain1.com/some/path
/domain2.com/some/path
并将其发送到
https://domain1.com/some/path
https://domain2.com/some/path
我已经使用 apaches ProxyPass 尝试了不同的设置,但没有成功
我该怎么做?
I have a web app at domain1.com which needs to be able to make requests to many different sites, too many to add specific vhost information for each site, what I'd like to be able to do is make a request with the web app to its hosting apache server like this
/domain1.com/some/path
/domain2.com/some/path
and for it to be send to
https://domain1.com/some/path
https://domain2.com/some/path
I've tried different settings using apaches ProxyPass but with no success
How do I do this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这应该能够与这些指令一起使用:
然后,对
https://yourproxy.com/domain1.com/some/path
的请求应转发到https://domain1。 com/some/path
.您也可能需要使用 mod_ssl 中的一些 SSLProxy* 指令。编辑根据评论,您可以尝试以下操作:
我刚刚尝试过,
http://myproxy.com:port1/myserver.com:port2/some/path
被发送到(并从)http://myserver.com:port2/some/path
返回。然而,从安全角度来看,这似乎是一个坏主意。我想它确实允许代理位于防火墙的一侧,并允许后端位于防火墙后面。我当然不是网络专家,但感觉有点粗略。
That should be able to work with these directives:
A request to
https://yourproxy.com/domain1.com/some/path
should then be forwarded on tohttps://domain1.com/some/path
. It is also possible you may need to use some of the SSLProxy* directives from mod_ssl.Edit Based on the comment, you might try this:
I just now tried that, and
http://myproxy.com:port1/myserver.com:port2/some/path
was sent on to (and returned from)http://myserver.com:port2/some/path
.However, this seems like a bad idea from a security standpoint. I suppose it does allow the proxy to sit on one side of a firewall and allow the backends to be behind the firewall. I am certainly no web expert, but it just feels a bit sketchy.