How it works
When you share a port, Ona creates a 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.URL Accessibility
The accessibility of shared port URLs depends on your Ona deployment configuration:- Ona Cloud: Open ports are accessible via public URLs on the internet. Anyone with the URL can access the service.
- Enterprise Runners: Open ports are accessible through your runner’s Network Load Balancer. Access is controlled by your network configuration and requires connectivity to your runner infrastructure. These URLs are not publicly accessible on the internet unless your runner’s load balancer is configured to allow public access.
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.0instead oflocalhostor127.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.
- Ona Cloud: Shared URLs are publicly accessible on the internet. Anyone with the URL can access your service.
- Enterprise Runners: Open URLs are accessible through your runner’s infrastructure. Access is restricted to users who can reach your runner’s Network Load Balancer, which is controlled by your network configuration and security policies.
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 on Ona Cloud, it will be accessible on the public internet. For Enterprise Runners, access is controlled by your network configuration. Be careful when sharing URLs.
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