After successfully installing an nginx reverse proxy in my home network, I managed to set up everything for accessing my already running openHAB instance from the internet.
The subdomain openHAB is running on is protected by .htaccess username and password, directly in the nginx settings.
From any Browser I can now access https://openhab.my-domain.de, enter my credentials and see and control my sitemap without any problems. This works on my Desktop PC and my Android Phone both with Firefox and Chrome browsers.
In the Android App I can also set https://openhab.my-domain.de as the “Remote Server URL” and supply my Username and Password. This also works, it is connecting to my openHAB installation via the remote URL. I can see the sitemap as usual.
But if I try to change a switch for example, which should turn on the light, nothing happens in my home. The switch Item in the sitemap shows the ON state, but it does not turn on anything. In the openhab events.log nothing is received. And as soon as I refresh the sitemap on my smartphone in the App (by pulling down) the switch state shows OFF again.
If I turn on the light via the local URL on the Desktop PC in my browser, it works normally and the change is instantly visible in the openHAB App connected to the remote URL.
If I then try to turn it off from the App, it’s the same problem.
Have I missed something obvious in some config options or could this potentially be a bug?
My nginx error.log does not contain anything related to this.
The nginx access.log shows these two lines whenever I try to switch the Item from the App:
What about the columns before the date in the nginx log file ?
Is the username for both entries ( working one and not working one ) the same ?
I am not sure if the OH app is able to handle .htaccess authentication.
For a test you may turn it off and e.g. use a rule on your routers firewall to only allow your phone to get in.
The two columns before Date/Time state the external IP (of phone or PC) and the username which is used for the .htacces authetication. Both are correct, that’s why I removed them from the post above.
If the Android App couldn’t handle the authentication, it wouldn’t be even able to show the Sitemap or not?
That’s the strange thing: I can see the sitemap, see when items states change, but can’t change anything from the App.
For a test I canged the .htaccess Password in the nginx Reverse Proxy, but not in my Phone:
The openHAB App gives an HTTP 401 Authentication failed error now.
After I set the correct password in the App again, everything is like before. So to me it seems that the Authentication isn’t the problem, but please correct me if you know better!
Meanwhile I tried the myopenhab.org Cloud Connector which works without any problems.
The advantage of this solution is obviously that I don’t need the reverse proxy for it anymore, and there is the possibility of receiving notifications too. So I think I’ll stick with this solution for now.
But please tell me, if I should try anything, which could fix my initial problem.