[GH-ISSUE #3163] [BUG]: Routing not working properly with base URL configured #2034

Closed
opened 2026-02-22 18:27:50 -05:00 by yindo · 1 comment
Owner

Originally created by @mr-mad-e on GitHub (Feb 10, 2025).
Original GitHub issue: https://github.com/Mintplex-Labs/anything-llm/issues/3163

How are you running AnythingLLM?

Docker (local)

What happened?

When a base URL is configured in the component, routing does not behave consistently across different navigation methods. Specifically, certain links redirect to the wrong URL, either including or excluding the base URL.

Steps to reproduce:

Set a base URL in your like so:

<Router basename="/llm">
    <App />
</Router>

Use different navigation methods:

Anchor (<a href={paths.home()} />): Redirects to / instead of /llm
React Router (<Link> (<Link to={paths.home()} />): Redirects correctly to /llm
Window navigation (window.location.href = paths.home()): Redirects to / instead of /llm
React Router navigate (navigate(paths.home())): Redirects correctly to /llm

Expected behavior:

All navigation methods should redirect to the correct path, respecting the base URL configuration (/llm in this case). Specifically, the following should all redirect to /llm:
<a href={paths.home()}>
window.location.href = paths.home()
navigate(paths.home())

Actual behavior:

Some navigation methods (e.g., <a href={paths.home()} />, window.location.href = paths.home()) redirect incorrectly to /, while others (e.g., <Link to={paths.home()} />, navigate(paths.home())) work correctly and redirect to /llm.

Additional context:
This behavior causes inconsistencies in the app’s routing, making navigation unreliable when working with a base URL.

Are there known steps to reproduce?

No response

Originally created by @mr-mad-e on GitHub (Feb 10, 2025). Original GitHub issue: https://github.com/Mintplex-Labs/anything-llm/issues/3163 ### How are you running AnythingLLM? Docker (local) ### What happened? When a base URL is configured in the <Router> component, routing does not behave consistently across different navigation methods. Specifically, certain links redirect to the wrong URL, either including or excluding the base URL. **Steps to reproduce:** Set a base URL in your <Router> like so: ```jsx <Router basename="/llm"> <App /> </Router> ``` **Use different navigation methods:** Anchor (`<a href={paths.home()} />`): Redirects to / instead of /llm React Router (`<Link> (<Link to={paths.home()} />`): Redirects correctly to /llm Window navigation (window.location.href = paths.home()): Redirects to / instead of /llm React Router navigate (navigate(paths.home())): Redirects correctly to /llm **Expected behavior:** All navigation methods should redirect to the correct path, respecting the base URL configuration (/llm in this case). Specifically, the following should all redirect to /llm: `<a href={paths.home()}>` window.location.href = paths.home() navigate(paths.home()) **Actual behavior:** Some navigation methods (e.g., `<a href={paths.home()} />`, window.location.href = paths.home()) redirect incorrectly to /, while others (e.g., `<Link to={paths.home()} />`, navigate(paths.home())) work correctly and redirect to /llm. **Additional context:** This behavior causes inconsistencies in the app’s routing, making navigation unreliable when working with a base URL. ### Are there known steps to reproduce? _No response_
yindo added the possible bug label 2026-02-22 18:27:50 -05:00
yindo closed this issue 2026-02-22 18:27:51 -05:00
Author
Owner

@timothycarambat commented on GitHub (Mar 19, 2025):

Changes like this for baseURL changes should be done in a fork

@timothycarambat commented on GitHub (Mar 19, 2025): Changes like this for baseURL changes should be done in a fork
yindo changed title from [BUG]: Routing not working properly with base URL configured to [GH-ISSUE #3163] [BUG]: Routing not working properly with base URL configured 2026-06-05 14:44:07 -04:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: Mintplex-Labs/anything-llm#2034