Search code examples
install4j

How to detect windows proxy settings after install4j v9.0


In our install4j installed application we use HttpClient (Apache) with "useSystemProperties" to perform http requests. Up until v9.0 of install4j that meant windows proxy settings were automatically applied. However, since 9.0.4 this no longer works (probably since 9.0.1 since proxy handling was reworked there, but I haven't been able to verify this). The installer itself still detects proxy settings (update check uses the proxy as before), but they are no longer "forwarded" to the installed application.

Is there a way to turn this "forwarding" back on?


Solution

  • In install4j 9.0.1+ the proxy settings are no longer available as system properties.

    On Windows, install4j 9.0.1+ uses native code, not Java sockets for HTTP requests. To force the use of Java sockets you can set the VM parameter

    -Dinstall4j.noWinInetConnection=true
    

    The auto-detected proxy that is used for the connection can then be obtained from

    com.install4j.runtime.installer.helper.content.ProxyHelper.getProxyHostInfo(url)