Lesson 0001 · Public URLs for lab guides
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]
private → token required ·
org → org members · public → anyone with the URL, no login.
$ python3 -m http.server 8080
8080 appear automatically, marked Private.https://…-8080.app.github.dev URL.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.
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" }
}
}
app.github.dev URL and is asked to sign in. What single thing is wrong?Read next (primary source): GitHub Docs — Forwarding ports in your codespace. The authoritative reference for visibility, the CLI, and the auth rules above.