GitHub Codespaces Port Forwarding Not Working

Share
Workaround available Browser, VS Code Updated November 14, 2026How we research

Quick answer

Codespaces forwards a port only when the app prints a localhost URL. Forward it manually, open it from the VS Code notification or Ports tab (not localhost in your own browser), and restart the app after the codespace wakes.

Most likely fix: Forward and open the port

How to fix it

Try these in order — the most common fix is first.

  1. 1. Forward and open the port

    1. Add the port manually in the Ports tab
    2. Open it from the notification in the bottom-right of VS Code or by clicking the URL in the Terminal
    Did this fix it?
  2. 2. After a restart

    1. Start the application again once the codespace restarts
    Did this fix it?
  3. 3. Visibility and URLs

    1. If Public or Organization is missing, ask an admin about the port visibility policy
    2. Use environment variables instead of hardcoded forwarded URLs in tests
    Did this fix it?

Symptoms

Forwarded port will not open, is not forwarded automatically, stops after a restart, or the public/organization visibility option is missing.

Why it happens

  • App did not print a localhost URL to the console
  • Typing localhost on your machine while using the browser editor does not reach the codespace
  • Codespace stopped after inactivity, which stopped your app
  • An organization policy restricts port visibility
  • A hardcoded forwarded URL broke because GitHub can change the forwarding domain

This guide also covers

  • codespaces port forwarding not working
  • codespace port not opening
  • codespaces localhost not working

Still not working?

If GitHub Codespaces keeps failing, you're not alone. See every GitHub Codespaces problem users report or the alternatives people switch to.

Have an app idea? Our small team builds any software: web and mobile apps, games, desktop, AI tools. Price agreed together.

Talk to us
Fixed it? Share this guide

The same problem in other apps

All storage, upload & download guides →

Other GitHub Codespaces errors

All 11 GitHub Codespaces errors and fixes →