Thingsboard Apache proxy settings

The default installation of the Thingsboard IoT software presents its client interface and dashboards on port 8080. To make it available on the standard HTTP port 80 I use an Apache2 virtual host with these reverse proxy settings. These settings assume your Thingsboard installation is visible on http://thingsboard.mysite.com:8080/ and you want to make it available on http://things.mysite.com/. Note that, as well as a reverse proxy for the HTML, you’ll also need one for the websockets which are used to deliver data. You’ll need to have the Apache2 mod_proxy installed and you’ll have to enable both mod_proxy and mod_proxy_wstunnel.

#
# Proxy  http://thingsboard.mysite.com:8080/ to http://things.mysite.com/
#
<VirtualHost *:80>
        ServerName things.mysite.com
        ServerAdmin admin@mysite.com

        # close off proxying while allowing reverseproxy
        ProxyRequests Off
        # pass header information through to the proxied host
        ProxyPreserveHost On

        # mod_proxy_wstunnel for the data websockets
        ProxyPass "/api/ws/" "ws://thingsboard.mysite.com:8080/api/ws/"
        ProxyPass "/api/ws/" "ws://thingsboard.mysite.com:8080/api/ws/"

        # mod_proxy for the vanilla HTML requests
        ProxyPass "/" "http://things.mysite.com:8080/"
        ProxyPassReverse "/" "http://things.mysite.com:8080/"

        LogLevel warn
        ErrorLog ${APACHE_LOG_DIR}/things.error.log
        CustomLog ${APACHE_LOG_DIR}/things.access.log combined
</VirtualHost>

Leave a Comment