codefloe/forgejo-codefloe
Watch
4
12
Fork
You've already forked forgejo-codefloe
0

fix(pages): keep underscores in git-pages owner hostnames #226

Merged
pat-s merged 1 commit from fix/pages-underscore-owners into v16.0/forgejo-codefloe 2026-10-06 17:11:55 +00:00
Owner

Fixes https://forum.codefloe.com/t/pages-usernames-with-an-underscore-get-malformed-host-name-http-400/207.

Problem

Sites owned by a user with an underscore in their name never publish on the git-pages backend.
The fork sanitised the owner into a DNS label (bodo_te → bodo-te).
git-pages maps the host label back to the owner to check push rights with the forge, so it checked bodo-te/blog, which does not exist, and refused the upload.
The settings page therefore stays at "Not published yet", and bodo-te.codefloe.page answers site not found.

The same mapping is also a collision: the publish token can push anywhere, so if a bodo-te user existed, the check would pass and the upload would overwrite that user's site.

Separately, git-pages rejects bodo_te.codefloe.page with 400 malformed host name because its strict IDNA check refuses _.
That half is fixed on the nodes by enabling git-pages' relaxed-idna feature in the pages-node ansible role.

Change

  • Use the lowercased owner name, unchanged otherwise, as the git-pages host label (gitPagesOwnerLabel), for publishing, the managed URL, the CNAME target, and the edge site-map.
  • Refuse owners whose name contains a dot when Pages is enabled, with a message telling the user why: a dot splits the hostname into two labels that the *.codefloe.page certificate does not cover, and replacing it would bring the collision back.
  • Leave such owners out of GET /api/v1/admin/pages/site-map.

Deploy order

Roll out relaxed-idna on the pages nodes before or together with this change, otherwise underscored sites publish but cannot be served.

Fixes https://forum.codefloe.com/t/pages-usernames-with-an-underscore-get-malformed-host-name-http-400/207. ## Problem Sites owned by a user with an underscore in their name never publish on the git-pages backend. The fork sanitised the owner into a DNS label (`bodo_te` → `bodo-te`). git-pages maps the host label back to the owner to check push rights with the forge, so it checked `bodo-te/blog`, which does not exist, and refused the upload. The settings page therefore stays at "Not published yet", and `bodo-te.codefloe.page` answers `site not found`. The same mapping is also a collision: the publish token can push anywhere, so if a `bodo-te` user existed, the check would pass and the upload would overwrite that user's site. Separately, git-pages rejects `bodo_te.codefloe.page` with `400 malformed host name` because its strict IDNA check refuses `_`. That half is fixed on the nodes by enabling git-pages' `relaxed-idna` feature in the pages-node ansible role. ## Change - Use the lowercased owner name, unchanged otherwise, as the git-pages host label (`gitPagesOwnerLabel`), for publishing, the managed URL, the CNAME target, and the edge site-map. - Refuse owners whose name contains a dot when Pages is enabled, with a message telling the user why: a dot splits the hostname into two labels that the `*.codefloe.page` certificate does not cover, and replacing it would bring the collision back. - Leave such owners out of `GET /api/v1/admin/pages/site-map`. ## Deploy order Roll out `relaxed-idna` on the pages nodes before or together with this change, otherwise underscored sites publish but cannot be served.
pat-s force-pushed fix/pages-underscore-owners from 59e81f8d97
Some checks failed
testing / backend-checks (pull_request) Has been cancelled
testing / test-unit (pull_request) Has been cancelled
testing / test-e2e (1/2) (pull_request) Has been cancelled
testing / frontend-checks (pull_request) Has been cancelled
testing / test-e2e (2/2) (pull_request) Has been cancelled
testing / test-pgsql (1/4) (pull_request) Has been cancelled
testing / test-pgsql (2/4) (pull_request) Has been cancelled
testing / test-pgsql (3/4) (pull_request) Has been cancelled
testing / test-pgsql (4/4) (pull_request) Has been cancelled
to 0dc90511fb
All checks were successful
testing / backend-checks (pull_request) Successful in 3m23s
testing / frontend-checks (pull_request) Successful in 1m23s
testing / test-unit (pull_request) Successful in 4m40s
testing / test-pgsql (3/4) (pull_request) Successful in 8m51s
testing / test-pgsql (4/4) (pull_request) Successful in 9m12s
testing / test-pgsql (2/4) (pull_request) Successful in 6m6s
testing / test-e2e (1/2) (pull_request) Successful in 6m30s
issue-labels / backporting (pull_request_target) Has been skipped
milestone / set (pull_request_target) Has been skipped
testing / test-e2e (2/2) (pull_request) Successful in 6m14s
testing / test-pgsql (1/4) (pull_request) Successful in 7m45s
2026-10-06 16:59:12 +00:00
Compare
pat-s scheduled this pull request to auto merge when all checks succeed 2026-10-06 17:02:29 +00:00
pat-s merged commit ed1b96c666 into v16.0/forgejo-codefloe 2026-10-06 17:11:55 +00:00
pat-s deleted branch fix/pages-underscore-owners 2026-10-06 17:11:55 +00:00
Sign in to join this conversation.
No reviewers
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
codefloe/forgejo-codefloe!226
No description provided.