Local Tunneling
Beeceptor's Local Tunneling lets you easily bind a web service on your localhost (development machine) to a Beeceptor's endpoint. All the requests hitting the Beeceptor endpoint will be routed to a local machine's port and response is served to the caller. This is a great feature to expose local port to the world.
All the requests and responses are visible on the endpoint dashboard as usual. Any request that gets matched to a mocking rule gets a mocked response (i.e. doesn't goes to tunnel).
This feature is available with paid plans and provided as beta preview only.
Step 1: Enable tunneling
Open the endpoint dashboard and enable tunneling for the endpoint.
Step 2: Install Beeceptor CLI
The Beeceptor CLI is a developer tool to help connect the local port with Beeceptor servers directly from your terminal. It is easy to install, works on macOS, Windows, and Linux. The Beeceptor CLI is available as an independent executable file.
Download Links
The downloaded file is a ZIP file, you will need to unzip it.
unzip <path-to-zip-file.zip>
Step 3: Authorize an endpoint
After installing the Beeceptor CLI, you must connect it with your Beeceptor endpoint. To do so, run the following command in the terminal with -p
option and specify a port number on localhost
. You’ll be prompted to launch your web-browser. Once logged in, you can grant or link a Beeceptor endpoint with this client-machine's authentication request.
Windows: Open Power Shell or Command Prompt to run the following:
beeceptor-cli-windows -p port-number
Mac: Open Terminal app and run the following:
./beeceptor-cli-macos -p port-number
Linux: Open bash or shell and run the following:
./beeceptor-cli-linux -p port-number
When you see a message "Now tunneling requests from... to this machine's port xxxx.", you are all set to receive requests from Internet to your local machine.
Example command to run: ./beeceptor-cli-macos -p 9006
Note: You may be asked to update the CLI if it is an obsolete version.
Step 4: Ready to receive requests
You are all set! Any request sent to your Beeceptor's endpoint will now be routed to this port on localhost. The response served by the local service, will be sent back to the caller.
Fun facts:
- If the service running on local port didn't respond within 60 seconds, the request times-out and error response will be sent.
- Any request that gets matched to a mocking rule gets a mocked response and never reaches to localhost's port.
- You shall see errors like
Failed to connect to host (refused)
if the service on local port is not reachable.