The Simplest Way to Make Caddy and Github Work Like They Should

Published
Length
3 min read

Luis Felipe Dias

All posts

Teams pair caddy and github to host web apps and automate code updates. Caddy serves traffic with TLS, while GitHub stores code and triggers builds. Together, they let teams ship changes from a repo to a live server. Developers push code to a branch, and the web server updates in seconds. This setup removes manual file copies and keeps server rules in version control. How caddy and github share identity and data Data flows between these tools in two main ways during daily work. First, GitHub

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 pair caddy and github to host web apps and automate code updates. Caddy serves traffic with TLS, while GitHub stores code and triggers builds.

Together, they let teams ship changes from a repo to a live server. Developers push code to a branch, and the web server updates in seconds. This setup removes manual file copies and keeps server rules in version control.

How caddy and github share identity and data

Data flows between these tools in two main ways during daily work. First, GitHub sends webhook events to Caddy when a developer pushes new commits. Caddy receives the event, checks the secret signature, and runs a local script. That script pulls the latest files and reloads the web server settings.

Second, teams use GitHub as an identity provider to protect internal web apps. A user visits a site hosted on Caddy and gets sent to GitHub. The user logs in with their GitHub account and approves the login request. GitHub sends a signed token back to the Caddy server to confirm identity. Caddy checks the user role and team membership before showing the internal page.

Both flows rely on shared secrets and scoped tokens to stay safe. Webhook listeners need a shared key to verify that incoming requests come from GitHub. OAuth logins need a client key and secret tied to a GitHub app. Storing and rotating these keys well is the core challenge for operations teams.

Common failure modes and how to scope roles

Many teams start by using a personal token from a senior engineer. They place this token on the Caddy host so scripts can pull code. This choice creates a big risk if the server gets breached by attackers. A personal token often has write rights across dozens of private code repos. If that engineer leaves the company, the deploy script breaks right away.

Instead of personal keys, teams should use deploy keys or dedicated GitHub apps. A deploy key grants read rights to a single repo and nothing else. If an attacker steals the key, they cannot touch other projects or settings. Teams should also leave write permissions off unless the server must push tags.

GitHub Actions Security + End-to-End Encryption: architecture patterns and best practices

Continue reading? Get the full guide.

Free. No spam. Unsubscribe anytime.

Another common mistake is skipping signature checks on incoming webhook routes. Anyone on the public internet can send a fake payload to an open route. Always check the cryptographic header using a strong shared secret before running deploy tasks. You can also filter requests by source network ranges published by GitHub.

Unlogged admin changes on the web host also cause serious outages in production. When engineers edit Caddy files by hand over SSH, the repo falls behind. The next automated run from GitHub will overwrite those local fixes without warning. Lock down direct file edits and force all rule changes through pull requests.

Managing server rules as code

Treating web server rules as code keeps your whole team on the same page. Store your routing files in a dedicated repo with branch protection turned on. Require at least one peer review before any change merges into the main branch.

Automated checks can test the syntax of your server files on every pull request. A quick runner job spins up a test instance and validates the routing rules. If a developer makes a typo, the build fails before reaching the live host. Once the check passes and merges, the host pulls the verified file and reloads.

Keep secret values out of the repo at all times during this process. Use local system variables on the host to hold OAuth keys and webhook secrets. The server reads those variables from memory when it starts or reloads routes. This habit stops keys from leaking in commit history or build logs.

Govern statements and responses across databases and APIs

Good config and scoped roles are needed setup. They do not check single queries in flight or mask sensitive fields in returned rows. Across Postgres, MySQL, SQL Server, MongoDB, ClickHouse, Kubernetes APIs, SSH, and internal HTTP endpoints, hoop.dev runs beside each supported service as an open-source proxy, a sidecar for your database or API.

First, hoop.dev guardrails block banned queries before they run. Then hoop.dev data masking rewrites matched sensitive values in responses in memory. The audit trail records every statement and verdict per resource. Furthermore, hoop.dev holds SOC 2 Type II and is open source on GitHub.

Frequently asked questions

How should Caddy pull private code from GitHub?

Use a read-only deploy key or a dedicated GitHub app with narrow repo permissions. Avoid using personal developer tokens on production web servers.

Can GitHub control who views apps hosted on Caddy?

Yes, you can link an OAuth plugin on your web server to a GitHub app. This setup checks team and team membership before letting users view internal sites.

How do we stop fake webhook requests from triggering deploys?

Set up a strong webhook secret in your repo settings and check it on arrival. Your server should drop any request that lacks a valid signature header.

The query runs. The emails stay hidden.