There are standard JVM system properties that you can use to set proxies for various protocol handlers, such as HTTP and HTTPS. These properties are used by Surf and all other parts of the system that make http call-outs.
All proxies are defined by a host name and a port number. The port number is optional and if not specified, a standard default port will be used.
The following properties can be set to specify the proxy that’ll be used by the HTTP protocol handler:
System property | Description |
---|---|
http.proxyHost | Specifies the host name or IP address for the proxy server. |
http.proxyPort | Specifies the port number for the proxy server. The default port number is 80. |
http.nonProxyHosts | Specifies the hosts that should be accessed without going through the proxy. |
The following properties can be set to specify the proxy that’ll be used by the HTTPS protocol handler:
System property | Description |
---|---|
https.proxyHost | Specifies the host name or IP address for the proxy server when using HTTPS (HTTP over SSL). |
https.proxyPort | Specifies the port number for the proxy server when using HTTPS (HTTP over SSL). The default port number is 443. |
For example, the following command directs all HTTP connections to go through the proxy server with the IP address 172.21.1.130, and the port number 8080:
java -Dhttp.proxyHost=172.21.1.130 -Dhttp.proxyPort=8080
In addition, you can also set the following non-standard properties for authenticated proxies:
Non-standard property | Description |
---|---|
http.proxyUser | Specifies the user name to use with an authenticated proxy used by the HTTP protocol handler. It should be left unset if the proxy doesn’t require authentication. |
http.proxyPassword | Specifies the password to use with an authenticated proxy used by the HTTP protocol handler. It should be left unset if the proxy doesn’t require authentication. |
https.proxyUser | Specifies the user name to use with an authenticated proxy used by the HTTPS protocol handler. It should be left unset if the proxy doesn’t require authentication. |
https.proxyPassword | Specifies the password to use with an authenticated proxy used by the HTTPS protocol handler. It should be left unset if the proxy doesn’t require authentication. |