Skip to content

feat: Full sub-path hosting support (BASE_URL with path)#1455

Open
3rg0n wants to merge 6 commits intogetfider:mainfrom
3rg0n:fix/subpath-hosting
Open

feat: Full sub-path hosting support (BASE_URL with path)#1455
3rg0n wants to merge 6 commits intogetfider:mainfrom
3rg0n:fix/subpath-hosting

Conversation

@3rg0n
Copy link

@3rg0n 3rg0n commented Feb 11, 2026

Summary

  • Fixes Support hosting Fider under a URL sub-path (e.g., 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.
  • Fixes Support relative path (e.g. example.com/feedback) #1298: Adds comprehensive sub-path hosting support so Fider can be hosted at e.g. example.com/feedback/ behind a reverse proxy.
  • Depends on fix: Context.BaseURL() returns full BASE_URL in single-host mode #1454 (includes that commit): The core Context.BaseURL() fix that preserves the path component from BASE_URL.
  • Adds a basePath() frontend utility (in navigator.ts) that extracts the path portion from Fider.settings.baseURL for use in href attributes and navigation.
  • Updates the http service's fetch() wrapper to automatically prepend the base path to all root-relative API calls (/api/v1/..., /_api/...).
  • Fixes navigator.goHome(), goTo(), and replaceState() to respect the base path.
  • Updates all hardcoded root-relative href attributes across 15+ React components.
  • Updates all hardcoded c.Redirect("/...") calls in 5 Go handler/middleware files to use c.BaseURL().
  • Updates views/index.html Atom feed <link> tags to use the template baseURL variable.

Files changed (24 total)

Backend (Go):

  • app/handlers/oauth.go — 3 redirects fixed
  • app/handlers/post.go — 1 redirect fixed
  • app/handlers/signin.go — 1 redirect fixed
  • app/handlers/signup.go — 1 redirect fixed
  • app/middlewares/tenant.go — 3 redirects fixed

Frontend services:

  • public/services/navigator.ts — New basePath() utility, fixed goHome/goTo/replaceState
  • public/services/http.ts — Auto-prepend base path to fetch URLs
  • public/services/index.ts — Re-export basePath

Frontend components (href fixes):

  • public/components/Header.tsx
  • public/components/UserMenu.tsx
  • public/components/ReadOnlyNotice.tsx
  • public/components/common/Legal.tsx
  • public/pages/Administration/components/SideMenu.tsx (12 links)
  • public/pages/Administration/pages/Export.page.tsx
  • public/pages/Administration/pages/GeneralSettings.page.tsx
  • public/pages/Administration/pages/ManageBilling.page.tsx
  • public/pages/Administration/pages/ContentModeration.page.tsx
  • public/pages/Home/Home.page.tsx
  • public/pages/Home/components/ShareFeedback.tsx
  • public/pages/SignIn/CompleteSignInProfile.page.tsx
  • public/pages/SignIn/LoginEmailSent.page.tsx
  • commercial/components/ModerationIndicator.tsx
  • commercial/pages/Administration/ContentModeration.page.tsx

Templates:

  • views/index.html — Atom feed link hrefs

Test plan

  • All 5 BaseURL unit tests pass
  • go vet passes on changed Go packages
  • Deploy with BASE_URL=https://example.com/feedback behind a reverse proxy
  • Verify all navigation links include /feedback prefix
  • Verify API calls (create/delete/vote on posts) go to /feedback/api/v1/...
  • Verify sign-in/sign-out redirects go to /feedback/ not /
  • Verify admin panel links work under the sub-path

🤖 Generated with Claude Code

3rg0n and others added 3 commits February 11, 2026 11:54
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>
3rg0n and others added 3 commits February 13, 2026 15:15
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>
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.

Support hosting Fider under a URL sub-path (e.g., example.com/feedback/) Support relative path (e.g. example.com/feedback)

1 participant