---
title: TestingBot Tunnel Examples
description: 'Learn how to configure TestingBot Tunnel with practical examples: tunnel
  identifiers, custom headers, upstream proxies, shared tunnels, and basic authentication.'
source_url:
  html: https://testingbot.com/support/tunnel/examples
  md: https://testingbot.com/support/tunnel/examples/index.md
---
# Tunnel Examples

This guide provides practical examples for configuring TestingBot Tunnel to suit your testing needs.

## Getting Started

First, [download the TestingBot Tunnel](https://testingbot.com/downloads/testingbot-tunnel.zip) and start it from the command line:

    java -jar testingbot-tunnel.jar key secret

Then update your test configuration to route traffic through the tunnel by changing the hub URL:

**Before (direct connection):**

    urlhub = "https://key:secret@hub.testingbot.com/wd/hub"

**After (through tunnel):**

    urlhub = "http://key:secret@localhost:4445/wd/hub"

By connecting to `localhost:4445`, all test commands are routed through the tunnel to TestingBot.

## Tunnel Identifiers

Tunnel identifiers allow you to run multiple tunnels simultaneously and direct specific tests to a particular tunnel. This is useful for parallel testing or when different tests require different tunnel configurations.

Start a tunnel with an identifier using the `-i` flag:

    java -jar testingbot-tunnel.jar key secret -i myTunnel

Then specify the identifier in your test's desired capabilities:

    {
      "browserName": "firefox",
      "browserVersion": "latest",
      "platformName": "WIN11",
      "tunnel-identifier": "myTunnel"
    }

## Custom Headers

Inject custom HTTP headers into all requests made through the tunnel. This is useful for authentication tokens, feature flags, or debugging headers.

    java -jar testingbot-tunnel.jar key secret \
    --extra-headers '{"MyOwnHeader": "HeaderValue"}'

## Upstream Proxy

Route tunnel traffic through an upstream proxy server. Common use cases include:

- Corporate networks that require all traffic to pass through a proxy
- Geo-location testing using proxies in different regions

Use the `-Y` flag to specify the proxy address and port. If the proxy requires authentication, add credentials with `-z`:

    java -jar testingbot-tunnel.jar key secret -Y myproxy:9000 -z username:password

## Shared Tunnels

By default, tunnels are only accessible to your user account. Enable the `--shared` flag to allow other team members to use your tunnel:

    java -jar testingbot-tunnel.jar key secret --shared

Team members can then connect to the shared tunnel without starting their own.

## Basic Authentication

Automatically supply credentials for websites that require HTTP Basic Authentication. The tunnel will inject these credentials for matching hosts, so your tests don't need to handle authentication dialogs.

Use the `-a` flag with the format `host:port:username:password`. For standard HTTP sites, use port 80:

    java -jar testingbot-tunnel.jar key secret -a mywebsite.com:80:myusername:mypassword

Was this page helpful? Yes No 

## Looking for More Help?

Have questions or need more information?   
 You can reach us via the following channels:

- [Email us](https://testingbot.com/contact/new)
- [Join our Slack Channel](https://join.slack.com/t/testingb0t/shared_invite/zt-3bcw9xch-jk19~6XPs_xBrsAgAedkCw)
