Page 1 of 1

Domoticz behind Apache proxy and not being able to re-login

Posted: Friday 04 December 2020 0:11
by hanryz
Dear all, I have run into the following trouble. My domoticz server (latest beta) sits behind an Apache 2.4 proxy and is doing fine. To access it under 192.168.0.16:8080 under http://192.168.0.16/projects/domoticz I have setup the following in httpd.conf of Apache:

<VirtualHost 192.168.0.16:80>
#The home DNS, if used, can serve this server name
ServerName YYY

<Location "/projects/domoticz/">
ProxyPass "http://192.168.0.16:8080/"
# Proxy pass reverse is not really neded.

RewriteEngine On
# webroot WebSockets handling by rewrite
RewriteCond %{HTTP:Upgrade} websocket [NC]
RewriteCond %{HTTP:Connection} upgrade [NC]
RewriteRule ^/?(.*) "ws://192.168.0.16:8080/json/$1" [P,L]

</Location>
</VirtualHost>

And this works perfectly good.

The problem occurs after I log out from domoticz web interface and want to login again. In this case, inspite of correct login credentials entered, the login screen presents me with "incorrect username/password" message. If I reload the page in Chrome, "Domoticz Offline" screen is presented (which is not true as the Domoticz is fine and can still be accessed directly on port 8080. In the Domoticz log I can see the following "Error: CheckAuthToken(101dc5bc96ad64014a5eb805486516d0_YWY2Yzk3OTItZerr3ZC00YjI3aslkNzktZmQwZmZiNasViN2I1) : session id not found."
To be able to login again, I need to clear cookies in the browser (Chrome). Then, I can enter the login credentials and Domoticz lets me in.

The indices tell me that the old session id might have been destroyed by Domoticz but is still used by the Apache proxy. Here I have no clue anymore how to resolve it and would like to ask maybe someone here has run into similar problems with cookies not being cleared properly when using proxy?

Any hint is welcome, thanks!

Re: Domoticz behind Apache proxy and not being able to re-login

Posted: Friday 04 December 2020 21:36
by hanryz
Nobody? I have done some investigation in the meanwhile.

The domoticz (paid) app (Android) is working flawlessly with the proxy setup I have.

The situation when the problem (of the original topic, see above) occurs is when it is attempted to log-out from domoticz and then to login again via proxy.

Then, the problem is that one cannot any longer login without prior deleting all cookies on the client side, irrespectively of what browser is used, Chrome, Edge or Firefox, whatever.

I think this is a problem on the Domoticz side and not on Apache configuration because other servers behind the Apache proxy server I have in my setup are working without problems for login and logout.

In other words, the sessions table in domoticz.db gets corrupted or so when it is logged out via proxy. Maybe gizmocuz or somebody from domoticz team (gizmocuz?) has an idea? Thanks