Apache反向代理重写 [英] Apache Reverse Proxy ReWrite

查看:103
本文介绍了Apache反向代理重写的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个Apache实例设置来反向代理内部应用程序.我使用mod_proxy进行了此工作,但最终结果是由于应用程序本身中的硬编码路径而导致图像和其他内容的缺乏.我想我有两个选择.

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

基本问题是这个.

外部站点: http://external.customer.com (端口80) 内部网站: http://internal.supplier.com:8080/testcustomer

External site: http://external.customer.com (Port 80) Internal site: http://internal.supplier.com:8080/testcustomer

我需要让apache代理连接,但是在与内部服务器internal.supplier.com:8080/testcustomer对话时,它必须使用完整的URL,并且必须重写路径,以便图像等将在最终客户端上呈现

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.

谢谢

推荐答案

那可能是因为您使用了src=/app/favicon.jpgsrc=/app/icons/smiley.jpg之类的绝对路径,而不是使用了src="favicon.jpg"之类的相对路径.

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".

可以通过添加有助于解析html的模块mod_proxy_html来解决此问题.

This problem can be solved by adding module mod_proxy_html which helps in parsing html.

然后在httpd.conf中加载LoadModule proxy_html,然后添加以下指令:-

Then LoadModule proxy_html in your httpd.conf and then add following directives :-

ProxyHTMLEnable On

SetOutputFilter proxy-html

mod_proxy_hmtl具有先决条件安装libxml2和libxml2-devel.您可以通过yum安装它.

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.

这篇关于Apache反向代理重写的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆