David Hipple
David Hipple

Reputation: 21

Thingsboard apache https redirect losses all telemetry data

My thingsboard site was working perfectly. I setup apache with LetsEncript and used a redirect rule to pass any http activity to https. the redriect works and I can log into thingboard, but none of my device have any telemetry data. if I locally log into thingsboard over http(not https) the devices have all of there telemetry. Not sure why the redirect would stop the site from accessing the database(if that is the problem).

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:

<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:

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.

Upvotes: 1

Views: 853

Answers (1)

David Hipple
David Hipple

Reputation: 21

I got it working. Seemed to be a websocket issue. I added the following lines to my config.

000-default-le-ssl.conf:

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

Upvotes: 1

Related Questions