Skip to content

Frontend assets fail when Gogs is served from a reverse-proxy subpath #8385

Closed

Description

@duytbp

Gogs version

latest-commit-build (2a00927)

Git version

  • Server: Not relevant
  • Client: Not relevant

Operating system

Not relevant

Database

Not relevant

Describe the bug

Hi! I found this while testing the current main branch for a production deployment under /gogs.

Gogs does not load its production frontend correctly when the reverse proxy strips the configured subpath.

The HTML entrypoints use /gogs/assets/..., but the proxy forwards those requests to Gogs as /assets/.... The production static handler expects the /gogs prefix, so the request may fall through to the SPA handler and return HTML instead of JavaScript or CSS.

Some nested bundle assets also use root-relative /assets/... URLs. These bypass the /gogs/* proxy route and return a 404.

I linked draft PR for the proposed fix

To reproduce

  1. Build Gogs from commit 2a0092707145 with the production frontend.

  2. Configure Gogs with:

    [server]
    EXTERNAL_URL = https://example.com/gogs/
  3. Configure Caddy to strip the external prefix:

    redir /gogs /gogs/
    handle_path /gogs/* {
        reverse_proxy 127.0.0.1:3000
    }
    
  4. Start Gogs and open https://example.com/gogs/.

  5. Inspect the browser network panel.
    Requests below /gogs/assets/ may return HTML instead of the expected asset. Nested requests to /assets/ return 404 because they are outside the /gogs/* route.

Expected behavior

All frontend assets should load through /gogs/assets/ externally and resolve through /assets/ after the proxy strips the prefix.

JavaScript, CSS, fonts, and worker files should return successful responses with their expected content types.

Additional context

No response

Code of Conduct

  • I agree to follow this project's Code of Conduct

Activity

  1. added
    💊 bug
    on Jul 12, 2026
  2. locked as resolved and limited conversation to collaborators on Oct 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    💊 bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions