1:代理訪問伺服器應用配置
A:192.168.0.11
B:192.168.0.12
訪問:http://192.168.0.11:9001/test/test.jsp
代理服務直接代理訪問:
http://192.168.0.12:9001/test/test.jsp
web.xml
<?xml version="1.0" encoding="UTF-8"?> <web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"> <servlet> <servlet-name>ProxyServlet</servlet-name> <servlet-class>weblogic.servlet.proxy.HttpProxyServlet</servlet-class> <init-param> <param-name>redirectURL</param-name> <param-value>http://192.168.0.11:9001/</param-value> </init-param> <init-param> <param-name>Debug</param-name> <param-value>OFF</param-value> </init-param> <init-param> <param-name>DebugConfigInfo</param-name> <param-value>OFF</param-value> </init-param> <init-param> <param-name>WLLogFile</param-name> <param-value>/tmp/logs/zfProxyServer.log</param-value> </init-param> <init-param> <param-name>verbose</param-name> <param-value>true</param-value> </init-param> </servlet> <servlet-mapping> <servlet-name>ProxyServlet</servlet-name> <url-pattern>/test/*</url-pattern> </servlet-mapping> </web-app>
weblogic.xml
<?xml version="1.0" encoding="UTF-8"?> <weblogic-web-app xmlns="http://xmlns.oracle.com/weblogic/weblogic-web-app" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd http://xmlns.oracle.com/weblogic/weblogic-web-app http://xmlns.oracle.com/weblogic/weblogic-web-app/1.0/weblogic-web-app.xsd"> <context-root>/</context-root> </weblogic-web-app>