Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Thingsboard nginx reverse proxy with websocket and HTTPS support (Let's Encrypt)
server {
listen 80;
server_name EXTERNAL_THINGSBOARD_DOMAIN.com;
if ($scheme != "https") {
return 301 https://$host$request_uri;
} # managed by Certbot
}
server {
listen 443 ssl;
server_name EXTERNAL_THINGSBOARD_DOMAIN.com;
ssl_certificate /etc/letsencrypt/live/example.com/fullchain.pem; # managed by Certbot
ssl_certificate_key /etc/letsencrypt/live/example.com/privkey.pem; # managed by Certbot
ssl_session_cache shared:SSL:1m;
ssl_session_timeout 1d;
ssl_protocols TLSv1.2;
ssl_ciphers 'ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA256';
ssl_prefer_server_ciphers on;
ssl_stapling on;
ssl_stapling_verify on;
location / {
proxy_pass http://LOCAL_THINGSGBOARD_IP_OR_DOMAN:8080;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "Upgrade";
proxy_set_header Host $host;
}
}
@XudongLiu

This comment has been minimized.

Copy link

XudongLiu commented Mar 7, 2018

This doc is very helpful. Thx.

@goboras

This comment has been minimized.

Copy link

goboras commented Apr 27, 2018

Works out of the box. Thanks

@motechsolutions

This comment has been minimized.

Copy link

motechsolutions commented Jun 28, 2018

Worked a treat for me, thank you

@BasSwildens

This comment has been minimized.

Copy link

BasSwildens commented Jul 10, 2018

location /dashboard/ {
proxy_pass http://LOCAL_THINGSGBOARD_IP_OR_DOMAN:8080;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "Upgrade";
proxy_set_header Host $host;
}

Thanks for your work on this, it was very helpfull. It looks like if I use a sub path like https://THINGBOARD.DOMAIN/dashboard/ there is a problem with serving javacomponents to the browser resulting in a blank page. Any thoughts on this?

Is there a config entry available to tune the root url in thingsboard?

root_url = %(protocol)s://%(domain)s/dashboard/

@paolofrs

This comment has been minimized.

Copy link

paolofrs commented Apr 26, 2020

worked for me alse (docker compose with nginx and thingsboard). Thank you very much!

@rsurgiewicz

This comment has been minimized.

Copy link

rsurgiewicz commented Jun 3, 2020

location /dashboard/ {
proxy_pass http://LOCAL_THINGSGBOARD_IP_OR_DOMAN:8080;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "Upgrade";
proxy_set_header Host $host;
}

Thanks for your work on this, it was very helpfull. It looks like if I use a sub path like https://THINGBOARD.DOMAIN/dashboard/ there is a problem with serving javacomponents to the browser resulting in a blank page. Any thoughts on this?

Is there a config entry available to tune the root url in thingsboard?

root_url = %(protocol)s://%(domain)s/dashboard/

Hi, same problem
tried nginx with location
/thingsboard but JS content is not loading.
@BasSwildens Did You find a solution?

@BasSwildens

This comment has been minimized.

Copy link

BasSwildens commented Jun 3, 2020

location /dashboard/ {
proxy_pass http://LOCAL_THINGSGBOARD_IP_OR_DOMAN:8080;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "Upgrade";
proxy_set_header Host $host;
}

Thanks for your work on this, it was very helpfull. It looks like if I use a sub path like https://THINGBOARD.DOMAIN/dashboard/ there is a problem with serving javacomponents to the browser resulting in a blank page. Any thoughts on this?
Is there a config entry available to tune the root url in thingsboard?

root_url = %(protocol)s://%(domain)s/dashboard/

Hi, same problem
tried nginx with location
/thingsboard but JS content is not loading.
@BasSwildens Did You find a solution?

We used a workaround by adding an extra CNAME to our dns, https://dashboard.domainname.com

@rsurgiewicz

This comment has been minimized.

Copy link

rsurgiewicz commented Jun 4, 2020

thanks, I might also try with rewrite plugin

@DavidR-fr

This comment has been minimized.

Copy link

DavidR-fr commented Jul 3, 2020

Thanks it works out of the box for me as well !!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.