Skip to content

Improve reverse proxy work, add captive portal detection#112

Merged
EdGeraghty merged 3 commits into
developfrom
reverse-proxy-work
Jun 8, 2026
Merged

Improve reverse proxy work, add captive portal detection#112
EdGeraghty merged 3 commits into
developfrom
reverse-proxy-work

Conversation

@EdGeraghty

Copy link
Copy Markdown
Member

This pull request adds support for Tailscale captive portal detection and improves reverse proxy handling in the configuration templates. The main changes are the addition of a handler for the /generate_204 endpoint in both HTTP and HTTPS Caddyfile templates, and the introduction of a trusted_proxies setting in the Headscale YAML template to properly honor client IP headers from trusted proxies.

Captive portal detection:

  • Added a handler for /generate_204 in both Caddyfile-http.template and Caddyfile-https.template to respond with HTTP 204, supporting Tailscale's captive portal detection mechanism. [1] [2]

Reverse proxy configuration:

  • Introduced a trusted_proxies section in headscale.template.yaml to specify which proxy IP ranges are trusted for True-Client-IP, X-Real-IP, and X-Forwarded-For headers, improving security and correct client IP logging.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates the deployment templates to better support Tailscale behaviour and more accurate client IP handling when running Headscale behind a reverse proxy (Caddy).

Changes:

  • Add a dedicated /generate_204 handler to both HTTP and HTTPS Caddy templates to support Tailscale captive portal detection.
  • Introduce a trusted_proxies section in the Headscale config template to control when proxy-provided client IP headers are honoured.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
templates/headscale.template.yaml Adds trusted_proxies configuration for trusted reverse proxy CIDRs.
templates/Caddyfile-https.template Adds /generate_204 handler returning HTTP 204 before other handlers.
templates/Caddyfile-http.template Adds /generate_204 handler returning HTTP 204 before other handlers.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread templates/headscale.template.yaml Outdated
I took this comment wholesale from upstream, but hardcoded localhost at the same time...

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
@EdGeraghty EdGeraghty merged commit 389ee06 into develop Jun 8, 2026
8 checks passed
@EdGeraghty EdGeraghty deleted the reverse-proxy-work branch June 8, 2026 11:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants