Skip to content

fix: Context.BaseURL() returns full BASE_URL in single-host mode#1454

Open
3rg0n wants to merge 1 commit intogetfider:mainfrom
3rg0n:fix/context-baseurl-path
Open

fix: Context.BaseURL() returns full BASE_URL in single-host mode#1454
3rg0n wants to merge 1 commit intogetfider:mainfrom
3rg0n:fix/context-baseurl-path

Conversation

@3rg0n
Copy link

@3rg0n 3rg0n commented Feb 11, 2026

Summary

  • Fixes [BUG] Context.BaseURL() strips path from BASE_URL, breaking subfolder/sub-path hosting #1452: Context.BaseURL() now returns env.Config.BaseURL (which includes the path component) when running in single-host mode, instead of calling Request.BaseURL() which strips the path.
  • This is the root cause of sub-path hosting being broken — the renderer passes ctx.BaseURL() to the frontend as Fider.settings.baseURL, so the path component (e.g., /feedback) was being lost.
  • Added two new unit tests (TestBaseURL_SingleHostMode and TestBaseURL_SingleHostMode_WithPath) and updated three existing tests to explicitly set HostMode = "multi".

Test plan

  • All 5 BaseURL tests pass (TestBaseURL, TestBaseURL_HTTPS, TestBaseURL_HTTPS_Proxy, TestBaseURL_SingleHostMode, TestBaseURL_SingleHostMode_WithPath)
  • go vet passes on the changed package
  • Deploy with BASE_URL=https://example.com/feedback and verify Fider.settings.baseURL includes /feedback in the browser

🤖 Generated with Claude Code

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>
3rg0n added a commit to 3rg0n/fider that referenced this pull request Feb 13, 2026
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>
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.

[BUG] Context.BaseURL() strips path from BASE_URL, breaking subfolder/sub-path hosting

1 participant