I am having issues just recently when connecting remotely using the proxy setup. It gives me the same issue from the android app, iPhone app, and browser.
The issue began around the time of my update to openHAB 3.1.0.M3 from M2 but I can’t pinpoint the exact date or if it was due to that.
Here is some info that may be helpful. ( local IP’s and hostnames have been masked )
My apache config that has been stable since December of 2020 when I got my last issue resolved is below.
<VirtualHost *:444>
ServerName xyz.example.com
SSLEngine on
Include /etc/letsencrypt/options-ssl-apache.conf
SSLCertificateFile /etc/letsencrypt/live/example.com/fullchain.pem
SSLCertificateKeyFile /etc/letsencrypt/live/example.com/privkey.pem
ProxyPreserveHost on
ProxyPass / http://10.0.0.1:8080/
ProxyPassReverse / http://10.0.0.1:8080/
RequestHeader set X-Forwarded-Proto "https" env=HTTPS
<Location />
AuthType Basic
AuthName "xyz.example.com 444 "
AuthUserFile /etc/apache2/.passwd
Require valid-user
Allow from 10.0.0.0/255.255.255.0
</Location>
</VirtualHost>
Here is the link to thread that helped me figure out what was wrong originally after migrating to OH3 when I had my first issue.
Below is my apache log when I try to use the openhab app on the android phone remotely using the apache proxy setup above. Notice that the first line gets a 200 response but the second gets a 401 Unauthorized access. This tells me that the username/password combo is correct because the first line goes through but somehow it is being prompted for authentication again and failing.
10.0.###.### - openhabuser [10/Apr/2021:08:35:55 -0400] "GET /rest/ HTTP/1.1" 200 6133 "-" "Mozilla/5.0 (Linux; Android 4.0.4; Galaxy Nexus Build/IMM76B) AppleWebKit/535.19 (KHTML, like Gecko) Chrome/18.0.1025.133 Mobile Safari/535.19"
10.0.###.### - openhabuser [10/Apr/2021:08:35:55 -0400] "GET /rest/sitemaps HTTP/1.1" 401 364 "-" "Mozilla/5.0 (Linux; Android 4.0.4; Galaxy Nexus Build/IMM76B) AppleWebKit/535.19 (KHTML, like Gecko) Chrome/18.0.1025.133 Mobile Safari/535.19"
I do have various virtualhosts set up on this server for other functions but to make sure that it is being captured by the correct virtualhost, I added the following two lines to my original virtualhost declaration up top and am now just looking at those two logs specific to this virtualhost. This assures me that it is not an issue with the virtualhost setup.
ErrorLog /var/log/apache2/oh_444_error.log
CustomLog /var/log/apache2/oh_444_access.log combined
I can access with no issue locally when I am on my home network (this bypasses the proxy and password setup).
When accessing from a firefox browser on an android phone remotely, I am able to get in. My basiui sitemaps however has a note on the bottom that says “SSE subscription failed. running in fallback mode” and I am getting these errors continuously.
166.175.167.22 - openhabuser [10/Apr/2021:10:11:10 -0400] "GET /rest/sitemaps/xyz/xyz?_=87906b6db52eb8 HTTP/1.1" 401 364 "https://xyz.example.com:444/basicui/app" "Mozilla/5.0 (Android 11; Mobile; rv:87.0) Gecko/87.0 Firefox/87.0"