简体   繁体   English

Thingsboard Apache HTTP重定向丢失所有遥测数据

[英]Thingsboard apache https redirect losses all telemetry data

My thingsboard site was working perfectly. 我的Thingsboard网站运行正常。 I setup apache with LetsEncript and used a redirect rule to pass any http activity to https. 我使用LetsEncript设置了apache,并使用了重定向规则将所有http活动传递给https。 the redriect works and I can log into thingboard, but none of my device have any telemetry data. 重新安装工作正常,我可以登录到thingboard,但是我的设备都没有遥测数据。 if I locally log into thingsboard over http(not https) the devices have all of there telemetry. 如果我通过http(而非https)在本地登录物联网,则设备具有所有遥测功能。 Not sure why the redirect would stop the site from accessing the database(if that is the problem). 不知道为什么重定向将阻止站点访问数据库(如果这是问题)。

000-default.conf: 000-default.conf:

<VirtualHost *:80>
    ServerAdmin webmaster@localhost
    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined
    RewriteEngine On
    RewriteCond %{HTTPS} off
    RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI}
</VirtualHost>

000-default-le-ssl.conf: 000默认-LE-ssl.conf中:

<VirtualHost *:443>
    ServerName My_Domain.com
    ProxyPreserveHost On
    ProxyRequests Off
    ProxyPass / http://localhost:8080/
    ProxyPassReverse / http://localhost:8080/
    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined

    SSLCertificateFile /etc/letsencrypt/live/My_Domain.com/fullchain.pem
    SSLCertificateKeyFile /etc/letsencrypt/live/My_Domain.com/privkey.pem
    Include /etc/letsencrypt/options-ssl-apache.conf
</VirtualHost>

Thingsboard.log: Thingsboard.log:

2019-02-01 01:19:54,577 [http-nio-0.0.0.0-8080-exec-3] ERROR o.s.w.s.s.s.DefaultHandshakeHandler - Handshake failed due to invalid Upgrade header: null
2019-02-01 01:19:58,567 [http-nio-0.0.0.0-8080-exec-1] ERROR o.s.w.s.s.s.DefaultHandshakeHandler - Handshake failed due to invalid Upgrade header: null
2019-02-01 01:20:00,773 [SockJS-2] INFO  o.t.s.d.n.CassandraBufferedRateExecutor - Permits queueSize [0] totalAdded [0] totalLaunched [0] totalReleased [0] totalFailed [0] totalExpired [0] totalRejected [0] totalRateLimited [0] totalRateLimitedTenants [0] currBuffer [0] 

Not sure what to do. 不知道该怎么办。 Any ideas. 有任何想法吗。

Thanks in advance. 提前致谢。

I got it working. 我知道了 Seemed to be a websocket issue. 似乎是一个websocket问题。 I added the following lines to my config. 我在配置中添加了以下几行。

000-default-le-ssl.conf: 000默认-LE-ssl.conf中:

    RewriteEngine on
    RewriteCond %{HTTP:UPGRADE} ^WebSocket$ [NC]
    RewriteCond %{HTTP:CONNECTION} ^Upgrade$ [NC]
    RewriteRule .* ws://localhost:8080%{REQUEST_URI} [P]

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM