I saw some post in the openHAB 4.3 Release Discussion concerning problems, that the log viewer in the GUI is not working.
The problem described there is that no logs are shown and the buttons start
, pause
and stop
are dysfunktional.
In my case this is due to the fact that my openhab installation is sitting behind an nginx proxy. By browsing the forum discussions I got the impression, that the GUI is using websockets to get the stream of logs.
So in case the problem is related to openhab sitting behind an nginx proxy, you have to alter the nginx configuration to support websockets.
This is mainly done through the directives:
server {
...
location / {
...
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "Upgrade";
}
proxy_http_version 1.1;
So in my case the configuration looks like:
server {
server_name smarthome.c.internal;
listen 443 ssl; # managed by Certbot
ssl_certificate /etc/letsencrypt/live/smarthome.c.internal/fullchain.pem; # managed by Certbot
ssl_certificate_key /etc/letsencrypt/live/smarthome.c.internal/privkey.pem; # managed by Certbot
# Cross-Origin Resource Sharing
add_header 'Access-Control-Allow-Origin' '*' always;
add_header 'Access-Control-Allow_Credentials' 'true' always;
add_header 'Access-Control-Allow-Headers' 'Authorization,Accept,Origin,DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Content-Range,Range' always;
add_header 'Access-Control-Allow-Methods' 'GET,POST,OPTIONS,PUT,DELETE,PATCH' always;
location / {
proxy_pass http://localhost:8080/;
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "Upgrade";
}
proxy_http_version 1.1;
include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot
}
server {
if ($host = smarthome.c.internal) {
return 301 https://$host$request_uri;
} # managed by Certbot
server_name smarthome.c.internal;
listen 80;
return 404; # managed by Certbot
}
After that the log viewer in the GUI came alive.
Cheers