Habpanel with Reverse Proxy

Hello,

I am using OH2 on Debian Jessie. I had setup an Apache Reverse Proxy to access http://openhab/habpanel/ instead of http://openhab:8080/habpanel/. Openhab itself (PaperUI, Basic and Classid UI) is working well. But Habpanel does not display content - " Connection lost! Trying to reconnect…".
Is this usecase supported? Do I have to configure something?

Thank you

It works fine for me
How is your reverse proxy configured? Post the config here to check it

This is my vhost configuration. SSL will be added if http is working.

<VirtualHost *:80>
        ServerName openhab.home.local
        ServerAlias openhab
        ProxyPass / http://localhost:8080/
        ProxyPassReverse / http://localhost:8080/
        <Proxy *>
                Order Deny,Allow
                Deny from all
                Allow from 192.168.0.0/24
        </Proxy>
        ServerAdmin webmaster@localhost
        ErrorLog ${APACHE_LOG_DIR}/openhab_error.log
        CustomLog ${APACHE_LOG_DIR}/openhab_access.log combined
</VirtualHost>

Try to add the websocket proxy also (not sure if it is really needed here… it should have worked without it):

	ProxyPass			/ws	ws://localhost:8080/ws	keepalive=on	retry=60
	ProxyPassReverse	/ws	ws://localhost:8080/ws	keepalive=on

Also, I recommend auth:

	<Location />
		AuthType Basic
		AuthName "openHAB2 Restricted"
		AuthUserFile /etc/apache2/.htpasswd
		Require valid-user
	</Location>

Let me know if this fixes the issue with HABPanel so I can update:

1 Like

To clear things up, this message is displayed when the SSE connection (to the /rest/events) used for server-pushed upadates is not working, perhaps unsurprisingly they can’t get through some reverse proxies. There should be additional info in your browser’s developer tools (Console and Network tabs).

I have added ws parts to apache config. But still not working.

calling /rest/items gives bad response

{
  "error": {
    "message": "d !\u003d java.lang.String",
    "http-code": 500,
    "exception": {
      "class": "java.util.IllegalFormatConversionException",
      "message": "d !\u003d java.lang.String",
      "localized-message": "d !\u003d java.lang.String"
    }
  }
}

just checking: calling http://<ip_of_OH2>:8080/rest/items works?
Your vhost setup is the same as mine and I have no problems whatsoever to access HABPanel from a remote location using reverse proxying…

By the way: you could always change the port that OH2 listens to from 8080 to 80 if you want.

1 Like

You probably have an issue somewhere in your items config then. Good luck finding where :frowning:
If the item(s) causing this is not in the sitemap that would explain why Basic UI works.

3 Likes

Found a issue in items config, now working :slight_smile:
Thank you!

@Dim: Also working without ws entries in Apache config

1 Like