I'm trying to connect to a website with javafx webengine/webview. I use a proxy that does not support the https protocol (so only http). When I try to connect to a http website, it works. However, when I try to load a https website, it ignores the proxy and uses my internet connection. When I use the same proxy in my browser I'm also able to connect to https websites and I wonder if it's possible to change my code so that the webengine will still use my http proxy instead of switching to my normal internet connection.
My code:
final String[] pArray = line.split(":");
System.out.println("IP:" + pArray[0] + " Port:" + pArray[1]);
System.setProperty("http.proxyHost",pArray[0]);
System.setProperty("http.proxyPort",pArray[1]);
System.setProperty("http.proxyUser",pArray[2]);
System.setProperty("http.proxyPassword",pArray[3]);
Authenticator.setDefault(
new Authenticator() {
@Override
public PasswordAuthentication getPasswordAuthentication() {
return new PasswordAuthentication(pArray[2], pArray[3].toCharArray());
}
}
);
System.setProperty("java.net.useSystemProxies", "true");
System.setProperty("jdk.http.auth.tunneling.disabledSchemes", "");
When I load my webengine:
engine.load("http://whatismyip.host");
The website (a http only website) displays the proxy IP.
But when I do:
engine.load("https://myip.is");
It shows the IP of my home connection, meaning it ignores the http proxy... How can I change that?
Regards