How it works
When you share a port, Ona creates a public URL with automatic TLS termination. Ona handles incoming HTTPS connections and forwards them to your service using either HTTP or HTTPS protocol, depending on your configuration.Protocol Support
When sharing a port, you can configure how Ona communicates with your service:- HTTP (default): Standard HTTP communication to your service
- HTTPS: Secure HTTPS communication for services requiring SSL/TLS connections
Limitations
- Not available on Gitpod Desktop environments.
- Subject to Ona’s fair use policies and bandwidth limits.
Prerequisites
To ensure port sharing works correctly, services must:- listen on
0.0.0.0
instead oflocalhost
or127.0.0.1
- be exposed from the Dev Container on the virtual machine using the host network stack.
0.0.0.0
instead of localhost
.
Security considerations
While port sharing is convenient, it’s important to be mindful of security:- Only share ports when necessary and unshare them when you’re done.
- Be cautious about sharing ports running sensitive services or containing confidential data.
- Remember that shared URLs are public and potentially accessible by anyone with the link.
Sharing ports
There are two ways to share ports from your Gitpod environment:Using the UI
In the Ona UI, you’ll see a section labeled “Public Ports” that allows you to manage port sharing for your environment. To share a new port:- Click the “Open Port” button in the “Public Ports” section.
- A dialog will appear titled “Open a public port”.
- Enter a name for the port (optional) and the port number you wish to share.
- Select the protocol (HTTP or HTTPS) for service communication.
- Click “Open Port” to confirm.
Security notice: When you open a port, it will be available on the open internet.
Be careful when sharing the URL.
Using the CLI
The Gitpod CLI provides a set of commands to manage port sharing. These commands allow you to list, open, and close ports directly from your terminal.Listing ports
To view all currently open ports:Opening a Port
To open and share a new port:--protocol
flag accepts:
http
(default): Standard HTTP communicationhttps
: Secure HTTPS communication
Closing a Port
To close a previously opened port:Examples
-
Open a port for a web server:
-
Open a port for an API server:
-
Open a port for a development server that requires HTTPS:
-
List all open ports:
-
Close a port that’s no longer needed:
Use cases
Port sharing enables various scenarios that enhance development workflows and collaboration:- Demonstrating work-in-progress: Quickly share your application with teammates or clients without deploying to a staging environment.
- API testing: Expose your development API server to test integrations with external services or mobile apps.
- Collaborative debugging: Share a running application with a colleague to troubleshoot issues together in real-time.
- Design reviews: Make your development server accessible so designers can review and provide feedback on UI changes.
- Webhooks development: Test webhook integrations by exposing your server to receive real-time events from external services.
- HTTPS-dependent applications: Test applications that require HTTPS protocol, such as:
- Applications with HTTPS-only policies or redirects
- Streaming APIs requiring secure connections
- Integration with external services requiring HTTPS callbacks