The Simplest Way to Make Caddy and GitHub Codespaces Work Like They Should
Teams use caddy and github codespaces to route web traffic inside cloud dev containers. This pair gives each coder a fast web server inside a remote workspace. Remote workspaces often run many small web apps on different local ports. A local web server groups those ports under clean domain names and handles TLS. How caddy and github codespaces handle traffic and keys GitHub Codespaces spins up a fresh cloud container for each developer task. Inside that container, developers run front-end ap
Your coding agents run with your access.
Claude Code reaches prod with a developer's credentials, and approval prompts get clicked through. hoop.dev checks every query, masks sensitive data, and holds risky changes for a human.
Teams use caddy and github codespaces to route web traffic inside cloud dev containers. This pair gives each coder a fast web server inside a remote workspace.
Remote workspaces often run many small web apps on different local ports. A local web server groups those ports under clean domain names and handles TLS.
How caddy and github codespaces handle traffic and keys
GitHub Codespaces spins up a fresh cloud container for each developer task. Inside that container, developers run front-end apps, APIs, and local data stores. Each service listens on its own internal port inside the virtual machine. GitHub forwards those ports to the coder through a browser link or local tunnel.
Running Caddy inside the container simplifies how those ports talk to each other. Instead of tracking five port numbers, the coder hits one entry point. The web server reads the request path and sends traffic to the right port. This setup matches how traffic flows in real production systems.
Log in rules stay tied to the developer's main GitHub account. When the coder opens the forwarded port URL, GitHub checks their session first. Only permitted users can reach the container from the public internet. Inside the container, the web server can also check local headers or test tokens.
Common risks and how to scope access
Many teams make mistakes when they set up cloud workspaces for their staff. The biggest risk is opening forwarded ports to the entire public internet. If a coder marks a port as public, anyone with the link can visit. If the web server routes to an internal tool, strangers can use it too.
Shared secrets inside the container file system create another major risk for teams. Developers often paste shared database keys or broad API tokens into config files. If those files get pushed to a code repo, anyone can read the keys. Shared service accounts also make it impossible to see which person ran a query.
GitHub Actions Security + End-to-End Encryption: architecture patterns and best practices
Continue reading? Get the full guide.
Free. No spam. Unsubscribe anytime.
To fix this, teams must lock down port rules at the org level. Admins should block public port sharing across all cloud workspaces by default. Every developer should use their own personal role when talking to outside services. Never store plain text keys inside web server files or container build scripts.
Teams also need clear logs when containers talk to real staging databases. When five people share one test key, audit logs show only that single key. If a bad query drops a table, the team cannot trace the action. Give each user a short-lived role and mask emails or card numbers in results.
Keeping local TLS and routing clean
Certificate alerts often slow down developers when they test web apps in the cloud. GitHub provides its own TLS wrapper on forwarded URLs over the public network. If the inner web server tries to issue public certificates too, loops can happen. The browser may block the page due to a redirect loop or bad cert.
The best fix is to let the outer platform handle public TLS checks. Configure the inner web server to listen on plain HTTP on a single port. It still routes paths to the right local apps without fighting the outer tunnel. For local host tests inside the container, use internal trust stores instead.
Check database and API queries on the wire
Identity tools, roles, and network rules decide who opens a session. Setup alone cannot check what each query does or mask sensitive values in a response once a session starts. When workflows touch Postgres, MySQL, SQL Server, MongoDB, ClickHouse, Kubernetes APIs, SSH, or internal HTTP APIs, hoop.dev runs beside those services as an open-source proxy, a sidecar for your Postgres or API. It inspects requests coming in and results going back on the wire.
Your login details and client tools stay as they are while hoop.dev guardrails refuse bad deletes or drops before they run. On responses, hoop.dev data masking rewrites matched sensitive values in memory. Furthermore, hoop.dev holds SOC 2 Type II, is MIT licensed, and writes every query and decision to an audit trail that generates evidence for HIPAA, GDPR, and PCI DSS. See the source on GitHub.
Frequently asked questions
Why do I get redirect loops with Caddy in GitHub Codespaces?
The cloud port forwarder already handles HTTPS for your public workspace link. Set your inner web server to serve plain HTTP on the forwarded port.
How do I stop developers from exposing internal ports to the public?
Use your GitHub org settings to turn off public port visibility for all workspaces. This rule forces every visitor to log in with a valid team account first.
Should we commit web server secrets into the dev container folder?
Never commit keys, passwords, or private certs into your repo files. Load user secrets at start time and scope every key to a single person.
Related guides
In this post