问题
I have a apache instance setup to reverse proxy an internal application. I have this working using mod_proxy, but the end result is a lack of images and other content due to hard coded paths in the application itself. I think I have two options.
- Mod_Rewrite
- Mod_HTML
The basic problem is this.
External site: http://external.customer.com (Port 80) Internal site: http://internal.supplier.com:8080/testcustomer
I need to get apache to proxy the connection, but it must use the full URL when talking to the internal server internal.supplier.com:8080/testcustomer and paths must be rewritten so that images etc will render on the end client.
Can anyone give me some guidance here? help would be much appreciated.
Thanks
回答1:
That may be becuse you have used absolute paths like src=/app/favicon.jpg
and src=/app/icons/smiley.jpg
......instead of relative paths like using src="favicon.jpg"
.
This problem can be solved by adding module mod_proxy_html which helps in parsing html.
Then LoadModule proxy_html in your httpd.conf and then add following directives :-
ProxyHTMLEnable On
OR
SetOutputFilter proxy-html
mod_proxy_hmtl has pre-requisite installs libxml2 and libxml2-devel.You can install it through yum.
If you could share your configuration file then may be we can help more.
来源:https://stackoverflow.com/questions/21833884/apache-reverse-proxy-rewrite