-
-
Save beije/5689935 to your computer and use it in GitHub Desktop.
<VirtualHost *:80> | |
ServerName 10.0.0.10 | |
# Set url to proxy | |
ProxyPass / http://hosts.domain.dev/ | |
ProxyPassReverse / http://hosts.domain.dev/ | |
# Set location | |
<location /> | |
# Set url | |
ProxyPass http://hosts.domain.dev/ | |
# Ouput html from proxy filter | |
SetOutputFilter proxy-html | |
# Add referer hack (if the site uses referrer as security) | |
Header add referer "http://hosts.domain.dev" | |
RequestHeader set referer "http://hosts.domain.dev" | |
# Overwrite html, exchange urls with proxied (like href, src, etc.) | |
ProxyHTMLExtended On | |
ProxyHTMLURLMap http://hosts.domain.dev http://10.0.0.10 | |
# For items that use style="background-image:url()" | |
ProxyHTMLEvents style | |
# You can add more url maps to overwrite if there are subdomains | |
# that you want/need to override | |
ProxyHTMLURLMap http://static.domain.dev http://10.0.0.10 | |
# Rewrite Cookie domain if the site uses sessions as an identifier | |
# i.e. PHPSESSID | |
ProxyPassReverseCookieDomain .domain.dev 10.0.0.10 | |
</location> | |
</VirtualHost> |
Hello, how are you ?
This solution looks a lot like something I need to do.
I have a domain that I need to point to another application in a remote domain.
However, access to the remote domain requires security of origin.
Can you help me?
I'm doing this but it does not work.
Grateful for the attention.
@marcelodelta you also need to rewrite the URLs.
In the stackoverflow thread you specifically say "However the page is fully loaded, missing some requests.", am I right to assume that it's about asset files?
In that case, you need to use ProxyHTMLURLMap so it'll change the contents and rewrite the proxied domain to the proxy's domain.
A json request.
How to use ProxyHTMLURLMap
Thanks for listening.
Can I send you more details?
Hello Benjamin,
why does the reverse proxy does not work for e.g. https://medium.com/dronehub?
The index page works, also the replacing of href but the submenus only show an error 404.
Is there any other security feature used by medium.com or is it a problem of the header which will be returned by the reverse proxy?
I see that medium.com uses json calls which have other behavior than when the website will be opened through the medium.com URL (the network sniffer contains different requests) .
I hope you have an idea.
Thanks.
@DieselDriver I can't say why it's not working without setting it up, but my initial hunch would be that not all the requests are made against medium.com but through other hosts, e.g. cdn's etc. You'd probably have to set up proxies against those URL's as well.
The relevant request for the main content is made against medium.com and I think they check the referer in other way as usual.
It's an interessting problem - this is the first website that makes troubles with a reverse proxy. :-(
Hi i have a problem with this configuration ,
the proxy is done, but the link replace don't work , can you hel me?
This is the configuration:
ServerName www.reart.it
ServerAlias reart.it
Set url to proxy
ProxyPass /shop http://shop.talya.it/
ProxyPassReverse /shop http://shop.talya.it/
Set location
<location /shop>
# Set url
ProxyPass http://shop.talya.it/