Connect Edge through a proxy
Running ThingsBoard Edge behind a proxy server means all outbound communication — specifically the gRPC connection to the ThingsBoard server on port 17100 — is routed through the proxy instead of going directly to the internet.
This setup is common in restricted network environments where direct internet access is deliberately blocked. Proxies also add a security layer by filtering and monitoring outbound traffic, and can cache resources to reduce bandwidth usage.
Prerequisites
Section titled “Prerequisites”- A proxy server (HTTP or HTTPS) with its host, port, and credentials if required.
- A list of addresses that should bypass the proxy (e.g., internal resources). Note that the Debian configuration uses
|as the separator, not commas. - Java 17 installed.
- ThingsBoard Edge installed and running.
Step 1. Modify the configuration file
Section titled “Step 1. Modify the configuration file”Edit /etc/tb-edge/conf/tb-edge.conf to enable the proxy:
sudo tee -a /etc/tb-edge/conf/tb-edge.conf > /dev/null <<EOL#Enable the proxyexport CLOUD_RPC_PROXY_ENABLED=true
#Set the proxy server host and portexport CLOUD_RPC_PROXY_HOST="proxy_host"export CLOUD_RPC_PROXY_PORT="proxy_port"EOLReplace proxy_host and proxy_port with your proxy’s hostname and port.
If certain hosts should bypass the proxy (e.g., local network addresses), add a NO_PROXY variable:
export NO_PROXY="localhost|127.0.0.1|yourdomain.com"Configure authentication (optional)
Section titled “Configure authentication (optional)”If your proxy requires authentication, append the following to the same file:
export CLOUD_RPC_PROXY_USERNAME="proxy_username"export CLOUD_RPC_PROXY_PASSWORD="proxy_password"Replace proxy_username and proxy_password with your actual credentials.
Verify the changes (optional)
Section titled “Verify the changes (optional)”cat /etc/tb-edge/conf/tb-edge.confConfirm that CLOUD_RPC_PROXY_ENABLED, CLOUD_RPC_PROXY_HOST, and CLOUD_RPC_PROXY_PORT appear with the correct values.
Step 2. Restart ThingsBoard Edge
Section titled “Step 2. Restart ThingsBoard Edge”sudo service tb-edge restartOnce restarted, open the Edge UI at http://localhost:8080 and log in with your tenant credentials. Go to Edge → Status and confirm the Status field shows Connected — this confirms Edge is reaching the server through the proxy.
Troubleshooting
Section titled “Troubleshooting”Check Edge logs for errors:
cat /var/log/tb-edge/tb-edge.log | grep ERRORTest connectivity through the proxy:
curl -x http://proxy_host:proxy_port https://your_tb_cloud_urlConfirm the proxy host is reachable:
ping proxy_hosttraceroute proxy_hostPrerequisites
Section titled “Prerequisites”- A proxy server (HTTP or HTTPS) with its host, port, and credentials if required.
- A list of addresses that should bypass the proxy, including internal resources, the database host (
postgres), and the ThingsBoard server IP or hostname. - ThingsBoard Edge installed and running via Docker Compose.
- Docker and Docker Compose installed.
Step 1. Stop the container
Section titled “Step 1. Stop the container”docker compose stopStep 2. Update docker-compose.yml
Section titled “Step 2. Update docker-compose.yml”Open the file:
sudo nano docker-compose.ymlAdd the following lines to the environment block:
HTTP_PROXY: http://proxy_user:proxy_password@proxy_host:proxy_port HTTPS_PROXY: http://proxy_user:proxy_password@proxy_host:proxy_port NO_PROXY: localhost,127.0.0.1,postgres,YOUR_TB_SERVER_IPReplace YOUR_TB_SERVER_IP with the IP address or hostname of your ThingsBoard server. If your proxy does not require authentication, omit the proxy_user:proxy_password@ part from the URL.
HTTP_PROXY/HTTPS_PROXY— proxy URL for HTTP and HTTPS traffic. Example:http://user:[email protected]:8080NO_PROXY— comma-separated list of addresses that bypass the proxy. Example:localhost,127.0.0.1,postgres,thingsboard.example.com
Step 3. Restart the containers
Section titled “Step 3. Restart the containers”docker compose up -d && docker compose logs -f mytbedgemytbedge is the default Edge container name. If you renamed your container, replace it in the command.
Once started, open the Edge UI at http://localhost:8080 and log in with your tenant credentials. Go to Edge → Status and confirm the Status field shows Connected — this confirms Edge is reaching the server through the proxy.
Troubleshooting
Section titled “Troubleshooting”Verify proxy environment variables are set:
echo $HTTP_PROXYecho $HTTPS_PROXYecho $NO_PROXYIf not set, check inside the running container:
docker exec -it container_name printenv | grep -i proxyTest internet access through the proxy from inside the container:
docker exec -it container_name curl -I https://google.comTest connectivity to ThingsBoard Cloud through the proxy:
curl -x http://proxy_host:proxy_port https://your_tb_cloud_urlCheck container logs for proxy-related errors:
docker logs container_name