feat: Full sub-path hosting support (BASE_URL with path)#1455
Open
3rg0n wants to merge 6 commits intogetfider:mainfrom
Open
feat: Full sub-path hosting support (BASE_URL with path)#14553rg0n wants to merge 6 commits intogetfider:mainfrom
3rg0n wants to merge 6 commits intogetfider:mainfrom
Conversation
Context.BaseURL() was always calling Request.BaseURL() which only returns scheme://host:port, stripping any path component from the configured BASE_URL. This broke all redirects and frontend navigation when Fider is hosted under a sub-path (e.g., BASE_URL=https://example.com/feedback). The package-level web.BaseURL() function already handled this correctly by returning env.Config.BaseURL in single-host mode. This change aligns the Context method with that behavior. Fixes getfider#1452 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Add basePath() utility that extracts the path component from BASE_URL,
enabling Fider to be hosted under a subfolder (e.g., example.com/feedback).
Backend: Replace all hardcoded c.Redirect("/") calls with c.BaseURL()
to ensure redirects respect the configured base path.
Frontend: Update all hardcoded href attributes and location.href
assignments to use basePath() prefix. Add automatic URL resolution
in the http service so API calls include the base path. Fix
navigator.goHome/goTo/replaceState to prepend the base path.
Fixes getfider#1453
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
TS6133 error - Fider was imported but only basePath is used. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
339da4a to
86469a4
Compare
Documents all installation types (single-host vs multi-host, with/without sub-path) and their test coverage. Includes unit test results and manual testing verification for the production deployment. Addresses maintainer feedback requesting testing across all supported installation types. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Add docker-compose test setup with Caddy reverse proxy and self-signed certificates to test all deployment scenarios locally: - Scenario 1: Single-host without sub-path (https://fider.local) - Scenario 2: Single-host WITH sub-path (https://app.local/feedback) - Scenario 3: Multi-host with subdomains (https://*.multi.local) Includes detailed test checklists, setup scripts, and quick-start guide. Addresses maintainer request to test against all supported installation types before merging PRs getfider#1454 and getfider#1455. Files added: - docker-compose-test.yml: Multi-scenario test environment - Caddyfile.test: Reverse proxy config with automatic HTTPS - TEST-SCENARIOS.md: Detailed test checklists for each scenario - QUICK-TEST.md: Fast setup guide - TEST-README.md: Overview and architecture - setup-hosts.sh/ps1: Host file configuration scripts Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Add Context.BasePath() method that extracts just the path prefix from BASE_URL for building redirect paths. Only hardcoded redirects are changed to use BasePath(); handlers already using BaseURL() are left as-is since the getfider#1452 fix makes them correct. Also fixes lint issues: prettier formatting in ContentModeration and SideMenu, adds rel="noreferrer" to Legal.tsx target="_blank" links. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
example.com/feedback/) #1453: Adds comprehensive sub-path hosting support so Fider can be hosted at e.g.example.com/feedback/behind a reverse proxy.example.com/feedback/behind a reverse proxy.Context.BaseURL()fix that preserves the path component fromBASE_URL.basePath()frontend utility (innavigator.ts) that extracts the path portion fromFider.settings.baseURLfor use inhrefattributes and navigation.httpservice'sfetch()wrapper to automatically prepend the base path to all root-relative API calls (/api/v1/...,/_api/...).navigator.goHome(),goTo(), andreplaceState()to respect the base path.hrefattributes across 15+ React components.c.Redirect("/...")calls in 5 Go handler/middleware files to usec.BaseURL().views/index.htmlAtom feed<link>tags to use the templatebaseURLvariable.Files changed (24 total)
Backend (Go):
app/handlers/oauth.go— 3 redirects fixedapp/handlers/post.go— 1 redirect fixedapp/handlers/signin.go— 1 redirect fixedapp/handlers/signup.go— 1 redirect fixedapp/middlewares/tenant.go— 3 redirects fixedFrontend services:
public/services/navigator.ts— NewbasePath()utility, fixedgoHome/goTo/replaceStatepublic/services/http.ts— Auto-prepend base path to fetch URLspublic/services/index.ts— Re-exportbasePathFrontend components (href fixes):
public/components/Header.tsxpublic/components/UserMenu.tsxpublic/components/ReadOnlyNotice.tsxpublic/components/common/Legal.tsxpublic/pages/Administration/components/SideMenu.tsx(12 links)public/pages/Administration/pages/Export.page.tsxpublic/pages/Administration/pages/GeneralSettings.page.tsxpublic/pages/Administration/pages/ManageBilling.page.tsxpublic/pages/Administration/pages/ContentModeration.page.tsxpublic/pages/Home/Home.page.tsxpublic/pages/Home/components/ShareFeedback.tsxpublic/pages/SignIn/CompleteSignInProfile.page.tsxpublic/pages/SignIn/LoginEmailSent.page.tsxcommercial/components/ModerationIndicator.tsxcommercial/pages/Administration/ContentModeration.page.tsxTemplates:
views/index.html— Atom feed link hrefsTest plan
go vetpasses on changed Go packagesBASE_URL=https://example.com/feedbackbehind a reverse proxy/feedbackprefix/feedback/api/v1/.../feedback/not/🤖 Generated with Claude Code