3 月 252017
 

Tomcat及Java配置并使用http proxy的方法

系统全局代理

export https_proxy=http://172.191.1.64:3128
export http_proxy=http://172.191.1.64:3128

在bin/catalina.sh增加配置

JAVA_OPTS="-Dhttp.proxyHost=172.191.1.64 -Dhttp.proxyPort=3128 \
-Dhttps.proxyHost=172.191.1.64 -Dhttps.proxyPort=3128 \
-Dhttp.nonProxyHosts='localhost|appserver1|127.*|10.*|100.*'"

在conf/catalina.properties增加配置
在/usr/java/jdk1.7.0_80/jre/lib/net.properties增加配置

http.proxyHost=172.191.1.64
http.proxyPort=3128
https.proxyHost=172.191.1.64
https.proxyPort=3128
http.nonProxyHosts=localhost|appserver1|127.*|10.*|100.*

在代码中指定连接代理配置

https://docs.oracle.com/javase/7/docs/technotes/guides/net/proxies.html
http://memorynotfound.com/configure-http-proxy-settings-java/

 Leave a Reply

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

(required)

(required)