Skip to content

web: load frontend entrypoints from absolute paths at the root mount - #8447

Merged
unknwon merged 1 commit into
mainfrom
fix-web-root-asset-paths
Nov 11, 2026
Merged

unknwon merged 1 commit into
mainfrom
fix-web-root-asset-paths

Conversation

@unknwon

@unknwon unknwon commented Nov 9, 2026

Copy link
Copy Markdown
Member

Describe the pull request

Since #8384, the production index.html references its entrypoint as ./assets/..., and renderIndex only rewrote that path when Gogs is served under a subpath. At the root mount, a direct load or reload of any React page nested below the root (e.g., /user/sign-in, /user/sign-up, /:owner/:repo/commit/:sha) requested /user/assets/index-*.js, got the HTML shell back, and rendered a blank page. Reaching those pages by navigating inside the app from / still worked, which hid the problem.

renderIndex now always makes the entrypoint paths absolute, prefixed with the subpath (which is empty at the root mount). Subpath deployments are unchanged.

No CHANGELOG entry because the regression is not in any release.

Checklist

  • I agree to follow the Code of Conduct by submitting this pull request.
  • I have read and acknowledge the Contributing guide.
  • I have added test cases to cover the new code and provided the test plan below.
  • I have added an entry to CHANGELOG.

Test plan

  1. TestRenderIndex_entrypointPaths fails on main (root case) and passes with this change. go test ./cmd/gogs/internal/web/ and go test -tags=prod ./cmd/gogs/internal/web/ pass.

  2. Built web with pnpm run build and Gogs with -tags prod, served at the root path, and loaded pages directly in Chromium:

    Page main (dd72be8) This PR
    /user/sign-in (direct load and reload) blank, fetched /user/assets/index-*.js renders, fetched /assets/index-*.js
    /user/sign-up blank renders
    / renders renders

    The commit before web: fix frontend assets behind reverse-proxy subpaths #8384 (2a00927) also renders /user/sign-in, since its entrypoint path was /assets/....

  3. golangci-lint run ./cmd/gogs/internal/web/... reports 0 issues.

Since #8384, the built index.html references its entrypoint as
./assets/..., and renderIndex only rewrote it under a subpath. At the
root mount, loading a page nested below the root (e.g., /user/sign-in)
directly requested /user/assets/..., which returned the HTML shell and
left the page blank.
@unknwon
unknwon merged commit 093d122 into main Nov 11, 2026
11 checks passed
@unknwon
unknwon deleted the fix-web-root-asset-paths branch November 11, 2026 20:54
appthin added a commit to appthin/gogs-plus that referenced this pull request Nov 12, 2026
Brings in the 0.14.4 security and bug fixes (gogs#8439, gogs#8472, gogs#8478, gogs#8480-gogs#8484,
gogs#8486, gogs#8488), the Highlights-based diff highlighter for the web UI (gogs#8492,
gogs#8434, gogs#8435), absolute entrypoint paths for the SPA shell (gogs#8447), Docker
workflow updates (gogs#8463, gogs#8475), and housekeeping.

Fork-specific code is preserved: CodeQL workflow, login bans, sign-in
protection, the -plus release pipeline, and the rewritten README.
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.

1 participant