Lesson 0001 · Public URLs for lab guides

The zero-install win: a public Codespaces port

Your lab already lives in a Codespace. So the fastest no-auth public URL needs no new tool at all — just flip one port to Public.

Every trainee running a Codespace already has a forwarding layer built in. When your web app listens on a port, GitHub gives it a URL like https://CODESPACENAME-PORT.app.github.dev. By default that URL is private — it demands a GitHub token. Change the port's visibility to Public and anyone with the link reaches it with no authentication at all. [GitHub Docs]

The one fact that matters Port visibility is the auth switch. private → token required · org → org members · public → anyone with the URL, no login.

Do it now (≈ 60 seconds)

  1. In your Codespace, start a web app on a port. Anything works — here's a throwaway:
    $ python3 -m http.server 8080
  2. Open the PORTS tab (next to Terminal). You'll see port 8080 appear automatically, marked Private.
  3. Right-click that row → Port VisibilityPublic.
  4. Click the copy icon next to the Forwarded Address. You now hold a https://…-8080.app.github.dev URL.
  5. Open it in a private/incognito window (so you're logged out of GitHub). It loads. That proves no auth. Paste it into your lab guide.
Your win You produced a public, authentication-free URL to a running web app without installing anything. That's a complete lab-guide step.

The CLI version (for copy-paste lab guides)

Menus don't paste into a guide; commands do. From a Codespace terminal, or from your laptop with the GitHub CLI:

$ gh codespace ports visibility 8080:public -c $CODESPACE_NAME

You can flip several at once — handy when a lab has an API and a UI:

$ gh codespace ports visibility 3000:public 8080:public -c $CODESPACE_NAME

Inside a Codespace, $CODESPACE_NAME is already set for you.

Bake it into the repo

To make the port forward appear for every trainee automatically, declare it in .devcontainer/devcontainer.json so nobody has to remember step 2:

{
  "forwardPorts": [8080],
  "portsAttributes": {
    "8080": { "label": "Lab app", "visibility": "public" }
  }
}
Two gotchas for your guide 1. An org owner can disable public ports entirely — test under the org the trainees will use, not your personal account. 2. The URL only lives as long as the Codespace does (and Codespaces stop when idle). Perfect for ephemeral labs; not a permanent link.

Check yourself

A trainee opens your app.github.dev URL and is asked to sign in. What single thing is wrong?
Which command makes port 3000 reachable with no login from a Codespace terminal?
I'm your teacher — ask me. Stuck on the PORTS tab, org policy blocking public ports, or how this behaves when the Codespace sleeps mid-lab? Ask in chat and we'll work it out before the next lesson.

Read next (primary source): GitHub Docs — Forwarding ports in your codespace. The authoritative reference for visibility, the CLI, and the auth rules above.