Enable subdirectory support by default - #3810
Conversation
|
Thanks! |
|
The new release (Docker container I'm super happy that @mikiher made the effort to implement it. 👍 However, I think there are few things that should be revised:
(Not sure if there's a simpler solution though.) |
It is still possible to use the environment variable to change the
You're right. We'll remove this.
Great! We should definitely provide at least one or two examples of modifying reverse proxy setups for subdirectory support (the existing setups should still work for subdomain). I'm not sure we can be responsible for providing details for every reverse proxy out there, but we definitely should encourage users to share their setups with us and publish them. You're also welcome to submit a PR to change the documentation, if you like! |
|
Shouldn't the default be |
| const pkg = require('./package.json') | ||
|
|
||
| const routerBasePath = process.env.ROUTER_BASE_PATH || '' | ||
| const routerBasePath = process.env.ROUTER_BASE_PATH || '/audiobookshelf' |
There was a problem hiding this comment.
@mikiher When the ROUTER_BASE_PATH env variable is set to an empty string in order to restore the old behavior then it overrides it to /audiobookshelf.
Is that expected? I would have thought that the /audiobookshelf fallback should only have been used in the case where the ROUTER_BASE_PATH env variable is undefined.
| const routerBasePath = process.env.ROUTER_BASE_PATH || '/audiobookshelf' | |
| const routerBasePath = process.env.ROUTER_BASE_PATH ?? '/audiobookshelf' |
Note that the nullish coalescing operator ?? was added in Node.js 14 and we currently require Node.js ≥ 20 so it shouldn't be a problem.
When the `ROUTER_BASE_PATH` env variable is set to an empty string it's mistakenly overriden to `/audiobookshelf` instead. The `/audiobookshelf` fallback should only be used when the `ROUTER_BASE_PATH` env variable is undefined, not just an empty string. Regression introduced in advplyr#3810 See also: advplyr#3810 (comment) Partially address advplyr#3874
Brief summary
Switch to enabling subdirectory support with
/audiobookshelfon the server and web client, according to the plan laid out in discussion #3535.Which issue is fixed?
This finally fixes #385
Users will now be able to set their reverse proxies to proxy
/audiobookshelfsubdirectory requestsIn-depth Description
This is the last step in supporting subdirectory with the existing static site generation approach.
The plan is described in detail in #3535.
As a reminder, this will set a fixed subdirectory of
/audiobookshelfon the web client (non-subdirectory paths will get rewritten by the server), and the server will support both subdirectory requests (with/audiobookshelfprefix) and non-subdirectory requests (with no prefix).Note: Mobile app support for subdirectory is already implemented and checked in with audiobookshelf-app PR #1417, but is pending release of a new version. Other mobile clients that would like to support subdirectory access will likely need to make some changes in the spirit of that PR.
How have you tested this?
This PR just switches the feature on by default.
The many changes required to make this happen were previously tested in respective previous PRs, and were tested again to make sure they still worked now.
One thing I haven't tested properly is the reverse proxy part, since my reverse proxy (on my Synology NAS) doesn't support support subdirectory proxying. I am sure this works well once you set it up on a supporting reverse proxy (like NGINX), but haven't tested this myself.