0

I was surprised to learn that the JVM does not automatically use the system proxy settings.

These need to be specified manually, or can be automatically detected when the java.net.useSystemProxies property (default false) is enabled.

I'm looking for more documentation about how this works, but what I've found is quite sparse. Specifically, my questions where:

  • Where is it looking for the proxy settings
  • Does it auto-detect for both HTTP & HTTPS
  • What is the reason this isn't the default behaviour - is there a drawback?

When I've looked online, all the documentation leads back to documentation from Oracle for Java 7. When changing the URL I can get documentation for Java 10, but nothing beyond that.

I was looking for documentation for both Java 11 and the latest version to see if there were any future changes.

Thanks.

Jakg
  • 922
  • 12
  • 39

1 Answers1

2

My research into documentation was fruitless, but I found partial answers in the Amazon Corretto source code.

Where is it looking for the proxy settings

The java.net.useSystemProxies property calls a native init method, which is implemented per-platform in DefaultProxySelector.c.

For Corretto 11, these can be found in GitHub.

For Windows specifically, these tie into the following Win32 APIs:

Does it auto-detect for both HTTP & HTTPS

The above APIs only offer HTTP versions so I would assume it sets both.

Jakg
  • 922
  • 12
  • 39