Support a Configurable Base Url (i.e. /agnaistic/)
Is your feature request related to a problem? Please describe. I want to serve Agnaistic, SillyTavern and Trilium via the same Apache proxy in order to avoid hard-to-memorize ports in the URL.
For Trilium and SillyTavern, this was almost trivial and I have them now accessible under http://myserver/silly-tavern and http://myserver/trilium.
I would like to do the same with Agnaistic, but when I set up an Apache proxy, all JS and CSS links still try to query resources from i.e. http://myserver/index.5bf1eb5c.js instead of http://myserver/agnaistic/index.5bf1eb5c.js
Describe the solution you'd like I would like to have another option in the settings that configured the base URL under which Agnaistic is being served to clients.
Describe alternatives you've considered I considered rewriting the HTML content with the extended Apache proxy functionality, but this is slow and prone to break things.
There are a few things you can try:
- Run agnai with the
INJECTenvironment variable with your desired<base ... />tag. This replaces the<meta inject />element with yourINJECTenvironment variable. - Reverse proxy path rewriting.
- Creating a subdomain or alternative domain for Agnai.
I tried this:
> su agnaistic
> export INJECT="<base href=\"/agnaistic\" />"
> node ./srv/start.js
But it doesn't seem to change anything. I tried looking for the 'INJECT' environment variable in the NodeJS Express documentation, but couldn't find anything useful.
Hand-editing dist/index.html to include <base href="/agnaistic" /> (yes, I know it's just the landing trampoline) for testing does not seem to yield the desired effect. My best guess is that since all URLs in the pages start with /, they all count as absolute and won't be affected by the <base href="..." /> element.
I've already tried path rewriting via Apache (as mentioned in my initial report), it's pretty messy due to the many JavaScript requests, I'd probably have to RegEx-replace something generic, i.e. '/ and "/, to get anywhere.
In this case I would definitely opt for a (sub)domain if you could. That would be the simplest solution. I'll dabble with the base URL when I have time.