Skip to content

Conversation

@jaredledvina
Copy link

@jaredledvina jaredledvina commented Dec 6, 2025

Resolves #649, #732
Related to #130

This PR updates the overall logic around the BASE_URL parameter. I've built Hunter off this branch and am running it. So far, it looks like this will completely restore the BASE_URL support so that it works as intended. See the commits for a break down for each of the bits.

I've locally tested this change with BASE_URL set to huntarr, changing to huntarrtesting, and then to '' and confirmed that in all 3 cases it works and adjusts the base path each time. I also dropped the env variable and confirmed that the DB saved the latest config and used that appropriately.

@jaredledvina jaredledvina force-pushed the fix/base-url-issue-649 branch from 4ed2bd5 to 80d5c33 Compare December 6, 2025 05:37
Previously BASE_URL only applied when base_url was empty in the database,
leaving users with incorrect values unable to recover without manual
database editing.

Now BASE_URL environment variable always overrides the database value when
set, providing a recovery path for misconfigured deployments.
Flask routes are registered at paths like /setup, but when BASE_URL is
configured, requests arrive as /huntarr/setup.

Added BaseURLMiddleware to strip the BASE_URL prefix from request paths
before Flask routing occurs, allowing routes to be found correctly.

Also normalized BASE_URL handling with helper functions to consistently
handle edge cases like '/', whitespace, and multiple slashes.
Updated all redirect calls to prepend BASE_URL when redirecting to setup,
login, and user pages. This ensures redirects work correctly when the
application is deployed under a reverse proxy subpath.

Fixes redirect loops that occurred when BASE_URL was configured.
Updated cycle countdown timer to use window.HUNTARR_BASE_URL when
constructing API URLs, ensuring API calls work correctly when BASE_URL
is configured for reverse proxy deployments.
@jaredledvina jaredledvina force-pushed the fix/base-url-issue-649 branch from 7764c1b to 8276422 Compare December 6, 2025 17:50
@jaredledvina jaredledvina changed the title Fix base_url configuration Fix BASE_URL support Dec 6, 2025
@jaredledvina jaredledvina marked this pull request as ready for review December 7, 2025 01:12
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.

Configuring the base_url seems to break the install

1 participant