Tomcat如何设置代理

展开全部tomcat设置代理的方法:在server.xml文件中增加以下节点:portConnector创建server socket并等待连接的TCP端口号。操作系统在特定的IP地址上只允许一个服务器应用程序监听特定的端口。protocol为了使用HTTP处理器,该属性值必须为HTTP/1.1(缺省值)proxyName如果connector在代理配置中使用,将这个属性设置成调用request.getServerName()时返回的服务器名称。更多信息参考代理支持。proxyPort如果Connector在代理配置中使用,这个属性指定了调用request.getServerPort()返回的端口值。更多信息参考代理支持。Configure your copy of Apache so that it includes the mod_proxy module. If you are building from source, the easiest way to do this is to include the --enable-module=proxy directive on the ./configure command line.If not already added for you, make sure that you are loading the mod_proxy module at Apache startup time, by using the following directives in your httpd.conf file:LoadModule proxy_module{path-to-modules}/mod_proxy.soAddModulemod_proxy.cInclude two directives in your httpd.conf file for each web application that you wish to forward to Tomcat 6. For example, to forward an application at context path /myapp:ProxyPass /myapp:8081/myappProxyPassReverse/myapp:8081/myappwhich tells Apache to forward URLs of the form /myapp/* to the Tomcat 6 connector listening on port 8081.Configure your copy of Tomcat 6 to include a special <Connector> element, with appropriate proxy settings, for example:<Connector port="8081" ...proxyName="www.mycompany.com"proxyPort="80"/>展开全部一般都是在你的应用中设置代理啊,Tomcat是接收服务的,怎么设置代理呢?一般要在你的连接代码前面,加上下面的设置。(如果用了其他的开源框架如httpclient,设置会有不同,请自行谷歌)System.getProperties().setProperty("proxySet", "true"));System.getProperties().setProperty("http.proxyHost", "X.X.X.X")); System.getProperties().setProperty("http.proxyPort", "XX");