Skip to content

fix(server): serve Swagger /docs correctly behind a reverse-proxy path prefix - #96

Closed
gustavobertoi wants to merge 2 commits into
mainfrom
feat/docs-base-path
Closed

gustavobertoi wants to merge 2 commits into
mainfrom
feat/docs-base-path

Conversation

@gustavobertoi

Copy link
Copy Markdown
Collaborator

Problem

When FUSE is hosted under a sub-path (e.g. api.uranus.com.br/fuse), opening /docs 404s: the
/docs handler redirected to the absolute /docs/index.html, so the browser dropped the
/fuse prefix.

Fix

  • The /docs redirect now honors the proxy's X-Forwarded-Prefix header, falling back to a new
    SERVER_BASE_PATH config (e.g. /fuse). The redirect target becomes <prefix>/docs/index.html.
  • The Swagger UI loads its spec via a relative URL (doc.json), which resolves under the prefix
    automatically (<prefix>/docs/doc.json); when SERVER_BASE_PATH is set it uses the explicit
    absolute URL.
  • Root hosting (no prefix) is unchanged.

Usage

Set SERVER_BASE_PATH=/fuse (or have the proxy send X-Forwarded-Prefix: /fuse). Documented in
.env.example.

Verify

make lint 0 · make build ok · make test 699 pass. Manual: behind a proxy at /fuse,
GET /fuse/docs → redirects to /fuse/docs/index.html and the UI loads the spec.

🤖 Generated with Claude Code

gustavobertoi and others added 2 commits June 4, 2026 00:36
…h prefix

When FUSE is hosted under a sub-path (e.g. api.example.com/fuse), the /docs
redirect used an absolute /docs/index.html, so the browser dropped the /fuse
prefix and 404'd. Now the redirect honors the proxy's X-Forwarded-Prefix header,
falling back to a new SERVER_BASE_PATH config; and the Swagger UI loads its spec
via a relative URL (doc.json) so it resolves under the prefix automatically (or an
absolute base-path URL when SERVER_BASE_PATH is set). Root hosting is unchanged.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@gustavobertoi

Copy link
Copy Markdown
Collaborator Author

Superseded by the consolidated PR #97 (which includes this docs base-path fix along with the agent leaf capabilities that need re-landing).

@gustavobertoi
gustavobertoi deleted the feat/docs-base-path branch June 4, 2026 06:19

This branch was previously deployed

1 inactive deployment
prod — e69d1208 Deployed Jun 4, 2026 by gustavobertoi via pr-image #321
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