Apache Reverse Proxy ReWrite

狂风中的少年 提交于 2020-01-06 08:39:48

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!