Skip to content

Port Forwarding Enhancements in Coder Desktop #587

@matifali

Description

@matifali

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions