Skip to content

Port Forwarding Enhancements in Coder Desktop #587

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
matifali opened this issue Apr 16, 2025 · 2 comments
Open

Port Forwarding Enhancements in Coder Desktop #587

matifali opened this issue Apr 16, 2025 · 2 comments

Comments

@matifali
Copy link
Member

Implement True Port Forwarding in Coder Desktop

Problem

Users can't click or use localhost:PORT links from terminal output or applications in Coder Desktop workspaces. This requires manual URL rewriting and creates a poor developer experience.

Solution

Implement true port forwarding in Coder Desktop that allows direct usage of localhost:PORT URLs.

Requirements

  1. Forward localhost:PORT connections from the workspace to the desktop environment
  2. Implement port forwarding to bind localhost:PORT to the corresponding <workspace>.coder:PORT
  3. Handle multiple workspace conflicts by prioritizing the most recently accessed localhost link
  4. Update documentation with port forwarding usage instructions

Technical Challenges

The implementation is complex due to several factors:

  1. VPN Connection Limitation: Coder Connect only provides a VPN connection and doesn't have inherent knowledge of which workspace terminal output is coming from.

  2. Remote SSH Complexity: When users connect to workspaces via remote SSH from local IDEs, there's no direct way for Coder Connect to track which workspace is generating localhost URLs.

  3. Context Awareness: The app needs to somehow become context-aware to route localhost requests to the correct workspace.

We need to explore a fundamentally different approach that doesn't rely on tracking terminal sessions or output sources.

Success Criteria

  • Clicking localhost:PORT links opens the correct service
  • Applications that auto-open localhost browser windows work as expected
  • Experience mirrors local development environment
  • No port conflicts between multiple workspaces
@deansheather
Copy link
Member

I dislike the idea of automatically forwarding ports to localhost. There can be so many services running in workspaces that you don't want forwarded, and the "context awareness" switching thing sounds too magic to be useful, especially when you want to use services from two workspaces at the same time.

@matifali
Copy link
Member Author

@deansheather suggested that we can probably add a setting for each workspace to bind specific ports to localhost.

We do have a plan to add a settings page to each workspace where we will configure the filesyncs, local app buttons and now port forwards.

JetBrains and VS Code IDEs also offer a similar port forwarding configuration.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants