-
Notifications
You must be signed in to change notification settings - Fork 13.4k
webui: add configurable base path support for subdirectory deployment #16079
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
webui: add configurable base path support for subdirectory deployment #16079
Conversation
- Add configurable base path in svelte.config.js (default: '' for backward compatibility) - Update all hardcoded URLs to use prefix for API calls and navigation - Enables deployment in subdirectories (e.g., /llama, /ai, etc.) while maintaining root deployment compatibility - Affected: fetch calls to /props, /v1, /slots and all goto/href navigation Note: Current implementation assumes client and API share same base path. Future enhancement could separate client base path from API base path for advanced proxy/security configurations where only client UI is in subdirectory.
Restoring the relative path behaviour of the previous UI would be a much better solution. The new UI likely broke for everyone using it behind a proxy and serving llama-server on something that is not `/'. |
You're right, that's exactly my case. I can add relative path behavior by adding a function that retrieves the current path to initialize the base. I tested pure relative everywhere (removing all leading / from fetch calls etc) but it breaks quite a few things. This configurable base path is the simplest solution I could find that doesn't break existing behavior. |
I think avoiding new solutions to a problem that should not exist is the right strategy. @allozaur, any thoughts on restoring the previous relative path behaviour? |
Hey guys! I will take a look at the relative paths subject tomorrow. Also, @ServeurpersoCom i haven't had any of the issues with the UI that u described, can you create separate issue(s) with screenshots/videos and more details? I'll do my best to tackle them asap. |
Here is the issue (and my proposal) : #16094 |
Co-authored-by: Aleksander Grygier <[email protected]>
Looks like SvelteKit's For example, https://github.com/mostlygeek/llama-swap runs the same |
I suspect we need to consider moving back to hash-based routing, as was done with the previous server, because:
When we moved to SvelteKit we dropped hash-based routing, which solves all this (relative paths will work the same on all routes with hash-based routing). With SvelteKit we can use hash-based routing using the EDIT: opened PR #16157 |
@ServeurpersoCom it will be better to go with #16157 proposed by @isaac-mcfadyen as the arguments he presented are very solid, but either way this PR got us much closer to solving the problem so i'd say this work did not go to waste 😉 |
…gml-org#16157) * Switched web UI to hash-based routing * Added hash to missed goto function call * Removed outdated SPA handling code * Fixed broken sidebar home link
…gml-org#16157) * Switched web UI to hash-based routing * Added hash to missed goto function call * Removed outdated SPA handling code * Fixed broken sidebar home link
Note: Current implementation assumes client and API share same base path. Future enhancement could separate client base path from API base path for advanced proxy/security configurations where only client UI is in subdirectory.
Make sure to read the contributing guidelines before submitting a PR