Apache Mod-Proxy修改标头为前向代理
我正在使用Apache Server作为代理,以便将一些自定义标头添加到Internet上转发到网站的请求中。我想要像中间的男人一样的阿帕奇。浏览器发送请求,Apache接收到它,添加一些标题,然后Apache将请求转发到原始请求端点。
而不是:
浏览器---> 我想要的网站
:
浏览器 - > Apache添加标头 - >网站
如何以最简单的方式实现我的目标?
我尝试过作为前向代理,但没有添加标头
<VirtualHost *:*>
ProxyRequests On
ProxyVia On
<Proxy *>
Require all granted
</Proxy>
Header set header "headerValue"
RequestHeader set header2 "header2value"
</VirtualHost>
,然后我尝试了反向代理,但是该网站无法加载某些静态资源,因为主机的主机被代理主机覆盖了。
<VirtualHost _default_:82>
ProxyPreserveHost Off
ProxyRequests Off
ProxyVia On
ProxyTimeout 300
<Proxy *>
Allow from all
</Proxy>
ProxyPass /something/something/ http://externalwebsite.com/something/something/
ProxyPassReverse /something/something/ http://externalwebsite.com/something/something/
</VirtualHost>
RequestHeader set header2 "header2value"
你能帮我吗?
非常感谢
i'm using apache server as proxy in order to add some custom headers to the request forwarded to a website on the internet. I want apache like a man in the middle. The browser send a request, apache receives it, it add some headers and then apache forward the request to the original request endpoint.
Instead of:
browser ---> website
I want:
browser --> apache add headers --> website
How can i achieve my goal in the simplest way?
I tried as forward proxy but the header is not added
<VirtualHost *:*>
ProxyRequests On
ProxyVia On
<Proxy *>
Require all granted
</Proxy>
Header set header "headerValue"
RequestHeader set header2 "header2value"
</VirtualHost>
then i tried as reverse proxy but the website couldn't load some static resource 'cause the Host header was overrided with the proxy Host.
<VirtualHost _default_:82>
ProxyPreserveHost Off
ProxyRequests Off
ProxyVia On
ProxyTimeout 300
<Proxy *>
Allow from all
</Proxy>
ProxyPass /something/something/ http://externalwebsite.com/something/something/
ProxyPassReverse /something/something/ http://externalwebsite.com/something/something/
</VirtualHost>
RequestHeader set header2 "header2value"
Can you help me pls?
Thank you very much
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论