When developing software on your Devbox, you will often want to expose local services running on your Devbox to the outside world. For example, you may want to have your agent start a local web server to serve a frontend application and then expose the live frontend to your users. Other examples include using tunnels:

  • to remotely collaborate on a frontend project,
  • test a web service,
  • access a Jupyter notebook running on your Devbox,
  • or access a local database running on your Devbox.

Let’s use Devbox tunnels to securely access ports on your Devbox over a simple url.

Setting up a tunnel

To set up a Devbox tunnel, first make any ports you will want to access available at Devbox creation time.

1

Create a devbox with the ports you want to expose

Create a devbox with the ports you want to expose.

2

Create a tunnel to the port you want to expose

When your devbox is created and running, you can now open a tunnel. Use the create_tunnel endpoint to create a unique URL to your devbox.

From the result, extract the url and open it in your browser to access the service running on your Devbox.

While the Devbox is active and the tunnel is open, the URL now has remote access to this port of your Devbox. Treat with care