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