Proxy Server for HTTP Binding

Tags: #<Tag:0x00007f616d991ff8> #<Tag:0x00007f616d991df0>

Hi All,

I’m quite new to OpenHAB, and haven’t quite got my head around it completely yet, so please bear with if this seems a little ‘basic’.

I have the Weather Binding (binding-weather1 - 1.10.0) installed in OpenHAB 2.1.0 release build. However, it seems to be trying to make outbound HTTP connections directly, rather than through the proxy server:

at org.apache.commons.httpclient.protocol.DefaultProtocolSocketFactory.createSocket(DefaultProtocolSocketFactory.java:80)[58:org.apache.servicemix.bundles.commons-httpclient:3.1.0.7]

from opanhab.log file, as well as the attempted connections seen on the Firewall.

Where do I configure the proxy settings in the Apache HTTP Client? I’ve previously had to configure proxy settings somewhere else to allow me to download bindings and addons (although, I can’t remember exactly where I did this!), but presumably binding needs it to be configured somewhere else. Will I have to configure proxy settings for other bindings I install that need Internet access as well?

Many thanks

This is a really good question I do not have the answer for.

This is an old thread but the solutions discussed might apply.

Thanks for pointing me in this direction, however, it doesn’t seem to have made any difference.

To clarify further: I’m running as a service under Windows Server 2012 R2 Server Core. I’ve now managed to get into the console (after figuring out that SSH connections are limited to localhost by default). Is there something from the console that allows me to view/set the proxy, or to test it without waiting for one of my tasks to trigger?

At what level should the proxy be set? It’s set at the OS level, does it also need to be set at Java? Keraf? Per Binding?

Many thanks

I don’t think so. Based on my very very old experience with Java and proxies it is something that needs to be set at the Java level. And it is usually set in the parameters passed to java when you run a program, or through environment variables.

Because the system level setting is a Windows only thing, most cross-platform languages like Java and Python cannot use it and need to be told about the proxy through some other way.

And it is usually set in the parameters passed to java when you run a program, or through environment variables

So, where would this be set in a Windows system, running OpenHAB as a service?

I’ve set the -Dhttp*.proxy* variables in /userdata/etc/openHAB-wrapper.conf and /runtime/bin/setenv.bat

I’ve also configured proxy details in userdata/config/settings.xml

Yet, the only connections to the proxy from the OpenHAB server’s IP address are OS initiated connections. Have I missed something?

I don’t know because I don’t know what .bat file is called when Windows starts the service. If it skips the wrapper and settings and just launches Java directly then those settings would not be picked up.