[PR #1600] [CLOSED] Add DERP generate_204 endpoint for captive portal detection. #2203

Closed
opened 2025-12-29 03:20:12 +01:00 by adam · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/juanfont/headscale/pull/1600
Author: @tomtom5152
Created: 11/14/2023
Status: Closed

Base: mainHead: derp204


📝 Commits (4)

  • 16766ae Add DERP generate_204 endpoint for captive portal detection.
  • ed1671e initial work on integration tests
  • afa064f add gh for new testcase
  • 61fe21d listen for generate_204 on 80

📊 Changes

5 files changed (+221 additions, -2 deletions)

View changed files

.github/workflows/test-integration-v2-TestDERPValidateEmbedded.yaml (+67 -0)
📝 hscontrol/app.go (+30 -0)
📝 hscontrol/derp/server/derp_server.go (+41 -0)
📝 integration/embedded_derp_test.go (+80 -1)
📝 integration/hsic/hsic.go (+3 -1)

📄 Description

  • read the CONTRIBUTING guidelines
  • raised a GitHub issue or discussed it on the projects chat beforehand
  • added unit tests
  • added integration tests
  • updated documentation if needed
  • updated CHANGELOG.md

When connecting to a DERP server the client makes a request to /generate_204 endpoint with the header X-Tailscale-Challenge. In order to pass the captive portal test, the server must provider a 204 NoContent response with X-Tailscale-Response set.

The source for this simple endpoint was taken directly from Derper source at the time of commit


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/juanfont/headscale/pull/1600 **Author:** [@tomtom5152](https://github.com/tomtom5152) **Created:** 11/14/2023 **Status:** ❌ Closed **Base:** `main` ← **Head:** `derp204` --- ### 📝 Commits (4) - [`16766ae`](https://github.com/juanfont/headscale/commit/16766ae20559346b25691c6e7cfc346ee3a99fe3) Add DERP generate_204 endpoint for captive portal detection. - [`ed1671e`](https://github.com/juanfont/headscale/commit/ed1671e01c81a03244b960df79dfe8ae8a56ce14) initial work on integration tests - [`afa064f`](https://github.com/juanfont/headscale/commit/afa064ff613e6e0da8ad933c8e9e0729ba394663) add gh for new testcase - [`61fe21d`](https://github.com/juanfont/headscale/commit/61fe21d710acf51041ab1f0bc6d0c0c974d0cef3) listen for generate_204 on 80 ### 📊 Changes **5 files changed** (+221 additions, -2 deletions) <details> <summary>View changed files</summary> ➕ `.github/workflows/test-integration-v2-TestDERPValidateEmbedded.yaml` (+67 -0) 📝 `hscontrol/app.go` (+30 -0) 📝 `hscontrol/derp/server/derp_server.go` (+41 -0) 📝 `integration/embedded_derp_test.go` (+80 -1) 📝 `integration/hsic/hsic.go` (+3 -1) </details> ### 📄 Description <!-- Headscale is "Open Source, acknowledged contribution", this means that any contribution will have to be discussed with the Maintainers before being submitted. This model has been chosen to reduce the risk of burnout by limiting the maintenance overhead of reviewing and validating third-party code. Headscale is open to code contributions for bug fixes without discussion. If you find mistakes in the documentation, please submit a fix to the documentation. --> <!-- Please tick if the following things apply. You… --> - [X] read the [CONTRIBUTING guidelines](README.md#contributing) - [ ] raised a GitHub issue or discussed it on the projects chat beforehand - [ ] added unit tests - [ ] added integration tests - [ ] updated documentation if needed - [ ] updated CHANGELOG.md <!-- If applicable, please reference the issue using `Fixes #XXX` and add tests to cover your new code. --> When connecting to a DERP server the client makes a request to `/generate_204` endpoint with the header `X-Tailscale-Challenge`. In order to pass the captive portal test, the server must provider a 204 NoContent response with `X-Tailscale-Response` set. The source for this simple endpoint was taken directly from [Derper source at the time of commit](https://github.com/tailscale/tailscale/blob/955e2fcbfb4fe7ff9b8dbd665ba24ef2008c676e/cmd/derper/derper.go#L324) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
adam added the pull-request label 2025-12-29 03:20:12 +01:00
adam closed this issue 2025-12-29 03:20:12 +01:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/headscale#2203