Domoticz behind Apache proxy and not being able to re-login
Posted: Friday 04 December 2020 0:11
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!
<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!