Private Environments
Private Environments
API Hub for Test Tunnel
Our recommended method for testing local and private environments is to use the API Hub for Test Tunnel, a desktop application that can be installed on your local machine or in your company’s infrastructure. The API Hub for Test Tunnel registers with the API Hub for Test API and establishes a secure, encrypted connection to API Hub for Test’s cloud test infrastructure. When the API Hub for Test Tunnel is enabled, all web requests initiated within a API Hub for Test test are proxied through the Tunnel, enabling your API Hub for Test tests to access local or private environments that are accessible to the machine that API Hub for Test Tunnel is running on.
Installation
The API Hub for Test Tunnel is a native, cross-platform application that can be run on Windows, macOS, or Linux. This feature is available to all Reflect accounts, regardless of usage tier.
The API Hub for Test Tunnel can be downloaded via our Downloads page.
Windows and macOS
On Windows and macOS devices, the API Hub for Test Tunnel runs as a system tray application. After installing and running the API Hub for Test Tunnel application, the application will reside in the system tray via the icon shown below:
macOS:

Windows:

LINUX:
The Linux version of the API Hub for Test Tunnel is a binary executable that can be run through the command-line or configured to run as a daemon process (such as systemd):
./reflect_tunnel -settings <location-of-settings-file>
Starting the Tunnel
In order for the API Hub for Test Tunnel to act as a proxy for your API Hub for Test tests, you must associate the Tunnel to your API Hub for Test account. This is done by entering your API Hub for Test API Key in the Settings of the API Hub for Test Tunnel.
Your API Hub for Test API key can be found on the Account Information page within the Settings section of API Hub for Test. This is the same API key that is used when invoking the API Hub for Test API directly, or when using one of our CI/CD integrations. If you have not already generated an API Key for your API Hub for Test account, you can do so through the button on this page.
WINDOWS AND MACOS
To link your API Hub for Test Tunnel to your account, click the icon in the system tray > menu bar, and select the Settings option:

This menu option will open a web browser to the Settings view for your API Hub for Test Tunnel:

The Settings view has the following configuration options:
Device Name: This is the name that will be associated with your Tunnel, and is the name that will appear when you choose a Tunnel when creating or running tests within API Hub for Test. By default, this will be set to the device name of your computer.
API Key: This is the linkage between your Tunnel and your API Hub for Test Account. This must match the API Key associated with your API Hub for Test Account.
To connect the Tunnel, click the ‘Enable API Hub for Test Tunnel’ toggle. If the Tunnel connects successfully, you’ll see that the toggle is set to enabled, a log line will appear stating that the Tunnel is connected, and the system tray icon will be updated to indicate that the Tunnel is connected.
LINUX
To start the Tunnel, you’ll need to first create a JSON file that looks like the following:
{ "deviceName": "Your Tunnel Name", "apiKey": "your-api-key" }
Pass the location of the settings file to the reflect_tunnel
application as a command line argument:
./reflect_tunnel -settings <location-of-settings-file>
When running the command-line application, the tunnel will attempt to connect using the API Key provided in the settings JSON file. If the connection is established successfully, you will see a log line indicating that the connection is successful.
Creating Tests Using the Tunnel
When creating a test within API Hub for Test, the option to route all traffic through a Tunnel is presented via a drop-down list to the right side under Reflect Tunnel > Connect via Tunnel.

Running Tests Using the Tunnel
Running individual tests
When running a test, you can choose to route traffic through a Tunnel byclicking the drop-down list in the upper right corner of the Run Test modal next to the Execute Request button. Select your desired Tunnel.

Running a suite of tests
To run all tests in a test suite via a Tunnel, first select the Suite and click on the Define Environment Settings box within the Workflow settings of the Suite. In the sidebar, choose the Tunnel that you’d like all future executions of this Suite to use:


If you’re invoking a test suite directly through the UI, you’ll also have this same Tunnel option within the Run Suite modal.
Configuring access
The list of all Tunnels connected to your API Hub for Test Accountcan be viewed by navigating to the Settings section and clicking the Local / Private Environments section from the sidebar.

From this same view, administrators can also disable the API Hub for Test Tunnel feature for your API Hub for Test account by de-selecting the toggle next to the ‘API Hub for Test Tunnel’ heading and clicking ‘Save Changes’.
Using a Static IP
An alternative approach to testing private environments is to enable API Hub for Testt’s Static IP feature for your API Hub for Test account. Some QA or staging environments may be restricted to only allow visitors coming from a specific IP address or set of IPs. By default, API Hub for Test assigns IP addresses to its cloud browsers from a range of dynamic IPs, which means they will not be able to access an IP-restricted environment. To support testing these environments, API Hub for Test can provision a static IP address for your account. This forces all cloud browsers (i.e., recordings and test runs) to egress from API Hub for Test with the same IP address. You can then add this IP address to the list of “allowed” IP addresses in your environment’s network ACL.
Note
Provisioning a static IP for your account is charged as an add-on to your subscription. For more information or to see a demo, please contact us at support@reflect.run
.