mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2026-05-30 23:40:40 +02:00
[Enhancement]: Add subfolder URL path instead of using a subdomain #218
Closed
opened 2026-04-24 23:01:18 +02:00 by adam
·
39 comments
No Branch/Tag Specified
master
book_tags_genres_dedupe
episode_download_fallback
Issue-4540-SortBy-StartedDate-and-FinishedDate
episode_meta_tagging
fix_authorize_race_condition
redirect_transcode_requests
progress_updated_sort
fix_ereader_socket_event
fix_change_empty_root_password
fix_podcast_session_track_index
fix_set_token
session_modal_user
localize_durations
fix_oidc_create_user
jwt_auth_refactor
fix_scanner_deleting_single_file_books
fix_mediaprogress_updatedat_2
experimental_next_client
podcast_episode_duration
episode-timestamps-clickable
book_author_secondary_sort_title
podcast_useragents
pathexists_user_access
fix_pathexists_join
book_author_secondary_sort
clean_duplicate_mediaprogress
sanitize_html_description
trix_prevent_attachments
check_path_api_fix
fix_mediaprogress_updatedat
increase_express_json_limit
fix_dockerfile_nunicode
search_episodes
audiobook_tools_update
episode_secondary_sorts
hls_stream_url_update
new_session_track_endpoint
audiobook_tools_enhancements
watcher_rescans_update
player_track_tooltip
fix_exclude_prefixes_crash
socket_item_events
fix_podcast_episode_scanner_promise
new_stats_controller
count_cache_for_userpermissions
parsing-opf-v3
validate_migration_files
fix-quick-match-all-crash
fix-chapter-end-sleep-timer
stringify_sequelize_query
remove-col-ambiguity
fix_next_prev_edit_description
details_trim_whitespace
fix_content_url_basepath
fix_logger_fatal
progress_bar_visibility
batch-edit-populate-map-details
feed_generator_updates
bookmark-modal-updates
migrate-library-item-in-scanner
migrate-new-library-items
migrate-podcasts-new-library-item-2
migrate-podcasts-new-library-item
fix-remove-episode-from-playlist
playback-session-use-new-library-item
refactor-library-item
fix-heatmap-caption
feed-episodes-upsert
share-media-player-media-session-api
remove-old-playlist
remove_old_collection_object
plugin-implementation-demo
feed_migration
refactor-feeds-from-item
fix_remove_authors_no_books
v2.17.3-fk-constraints-migration
migrations-first-upgrade
sqlite_2
feature/nuxt-target-server
waveform
sqlite
playlists
video
v2.35.1
v2.35.0
v2.34.0
v2.33.2
v2.33.1
v2.33.0
v2.32.1
v2.32.0
v2.31.0
v2.30.0
v2.29.0
v2.28.0
v2.27.0
v2.26.3
v2.26.2
v2.26.1
v2.26.0
v2.25.1
v2.25.0
v2.24.0
v2.23.0
v2.22.0
v2.21.0
v2.20.0
v2.19.5
v2.19.4
v2.19.3
v2.19.2
v2.19.1
v2.19.0
v2.18.1
v2.18.0
v2.17.7
v2.17.6
v2.17.5
v2.17.4
v2.17.3
v2.17.2
v2.17.1
v2.17.0
v2.16.2
v2.16.1
v2.16.0
v2.15.1
v2.15.0
v2.14.0
v2.13.4
v2.13.3
v2.13.2
v2.13.1
v2.13.0
v2.12.3
v2.12.2
v2.12.1
v2.12.0
v2.11.0
v2.10.1
v2.10.0
v2.9.0
v2.8.1
v2.8.0
v2.7.2
v2.7.1
v2.7.0
v2.6.0
v2.5.0
v2.4.4
v2.4.3
v2.4.2
v2.4.1
v2.4.0
v2.3.5
v2.3.4
v2.3.3
v2.3.2
v2.3.1
v2.3.0
v2.2.23
v2.2.22
v2.2.21
v2.2.20
v2.2.19
v2.2.18
v2.2.17
v2.2.16
v2.2.15
v2.2.14
v2.2.13
v2.2.12
v2.2.11
v2.2.10
v2.2.9
v2.2.8
v2.2.7
v2.2.6
v2.2.5
v2.2.4
v2.2.3
v2.2.2
v2.2.1
v2.2.0
v2.1.5
v2.1.4
v2.1.3
v2.1.2
v2.1.1
v2.1.0
v2.0.24
v2.0.23
v2.0.22
v2.0.21
v2.0.20
v2.0.19
v2.0.18
v2.0.17
v2.0.16
v2.0.15
v2.0.14
v2.0.13
v2.0.12
v2.0.11
v2.0.10
v2.0.9
v2.0.8
v2.0.7
v2.0.6
v2.0.5
v2.0.4
v2.0.3
v2.0.2
v2.0.1
v1.7.2
v1.7.1
v1.7.0
v1.6.0
v1.5.5
v1.5.0
v1.4.11
v1.4.9
v1.4.7
v1.4.6
v1.4.4
v1.4.2
v1.4.0
v1.4.1
v1.3.4
v1.3.3
v1.3.1
v1.2.8
v1.2.6
v1.2.5
v1.2.4
v1.2.1
v1.1.15
v1.1.14
v1.1.13
v1.1.12
v1.1.11
v1.1.10
v1.1.9
v1.1.8
v1.0.0
0.9.61-beta.0
0.9.61-beta
Labels
Clear labels
authentication
backlog
bug
chapter editor
config-issue
ebooks
encoding/embedding
enhancement
help wanted
listening sessions & progress
planned
possible plugin
progress sync
pull-request
sorting/filtering/searching
unable to reproduce
upload
users & permissions
waiting
Mirrored from GitHub Pull Request
No Label
enhancement
Milestone
No items
No Milestone
Projects
Clear projects
No project
Assignees
adam (Adam Melkus)
Clear assignees
No Assignees
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: starred/audiobookshelf#218
Reference in New Issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @maartenbrakkee on GitHub (Mar 1, 2022).
Describe the feature/enhancement
For reverse proxy usage with a subfolder instead of a subdomain. E.g.,
/audiobookshelf/instead of/.@unclebacon-live commented on GitHub (Mar 7, 2022):
I second this.
@whiskywaffel commented on GitHub (Mar 9, 2022):
Would be a nice. Is there any chance this gets implemented?
@sandreas commented on GitHub (May 7, 2022):
+1
I would suggest to use
process.env.serverUrlwherever possible...Maybe it helps collecting code permalinks, that maybe need to be adjusted?
Probably (server and client-config):
Maybe (client):
What about the app?
@sandreas commented on GitHub (May 31, 2022):
@advplyr
How is the state of this issue? You said in #570:
So there is work to do in:
I did not find a branch with your failed attempt, but I would really like to help you with this issue and submit a PR, if you don't have the time. I would just need your help to point me into the right direction... the collected parts of code above might be a first step, but I do not know, what code parts may be also critical / necessary...
Should I fork and create a branch / PR for discussion? Or would you just list the things you tried out and failed with?
Thank you.
@advplyr commented on GitHub (Jun 1, 2022):
Thanks, I could use some help.
The first step is the base url will need to be passed in as an environment variable for docker or specified in the config file for debian.
The part where I got hung up was passing that environment variable to the Nuxt.js app so that we can set the base url in the nuxt.config.js file. I'm not sure the best way to handle that. I think setting that would handle the web app client portion of this.
I'm not sure exactly what would be needed on the server yet.
The mobile apps would need to store the base url separately. I haven't gotten too deep into this since I got hung up on the web app client.
We can chat about this in discord also if that is easier or start a discussion in GH whichever you prefer.
@sandreas commented on GitHub (Jun 1, 2022):
Progress update:
BASE_URLinto the/servercomponent: https://github.com/advplyr/audiobookshelf/compare/master...sandreas:master@advplyr commented on GitHub (Jun 1, 2022):
Oh great, how are you passing the env variable to the nuxt app?
@sandreas commented on GitHub (Jun 1, 2022):
That is something I am working at. I tried some static options first and it worked partially with the options
routerandbaseUrl:The
nuxt-config is very fiddly here. A missing/or one too much at the wrong place and it does not work at all. Seems that this is influenced by the server config indev.js/index.js. I'm not even sure, wether that default value forBASE_URLshould be `` (empty string) or/(slash).I'm currently trying to figure out a reliable way to make this work and if I have this, I'll try the dynamic configuration. There is also this ticket: https://github.com/nuxt/nuxt.js/pull/7312 which might help to configure it runtime, so that one does not need to retranspile the whole client for changing the
baseUrl.Maybe
BASE_URLshould also be renamed toPREFIX(like here), since we only wanna change the last part of the url... we'll see, I'm pretty busy atm, maybe this takes some time to figure out.@advplyr commented on GitHub (Jun 2, 2022):
Prefix is better since that is all we want passed into the env variable.
I was having the same issue you are working on. We can use the runtime config but the problem I had was actually accessing that env from the client. The env's available on the server aren't available in the nuxt app.
@sandreas commented on GitHub (Jun 2, 2022):
Ok, I'll regard that. Currently it is an experiment - not a working thing. Maybe I have to rethink everthing.
I'm aware of this. I would prefer this
because without a leading slash using relative references it would work everywhere without any runtime changes or variables. It seems that
nuxtdoes not allow `` (empty string) and replaces it with/. I would see that as anuxtbug, because it makes a very important feature unusable - REAL relative paths.Instead of using
/_nuxt/0sdrcie.jsit would use_nuxt/0sdrcie.js, result:That is what I am investigating.
Here are some links:
@advplyr commented on GitHub (Jun 18, 2022):
@sandreas I missed your last comment here. Are you still working on this? I can look into this today
@sandreas commented on GitHub (Jun 19, 2022):
@advplyr Not really, my son was born 6 days ago, now I don't have the time. Would love to see you look into this, otherwise this will take a lot of time, the next 3 weeks no development ;)
@advplyr commented on GitHub (Jun 19, 2022):
@sandreas Congrats! Thanks for the update
@RocketRammer commented on GitHub (Jul 13, 2022):
Hope your new son is doing well @sandreas! - He's what, 4/5 weeks old now? - He must be sleeping through the night and barely disturbing you, right?.. right!? :D
I have no way of helping with the development other then offering to be a guinea pig beta tester when it gets there!
Fingers crossed for this in the near future.
@sandreas commented on GitHub (Jul 13, 2022):
@RichardMawdsley
Yeah he is alright thank you.
Unfortunately this is not the way it goes ;-) However, its surprising how insomnia gets you back to development. But @advplyr was very right: nuxt is really nasty here. I tried many things to get this working reliably but atm I'm out of ideas... My branch contains a PARTIAL solution for ONE problem and combines multiple points of failure to one. But since I'm not a nuxt expert and it was really frustrating to debug this, I'm not going to invest time here in the next weeks.
I have a lot of projects going on and since this problem would be "nice to have" and is not mandatory for my system to work, I deferred my efforts to get this working.
@1nVitr0 commented on GitHub (Apr 22, 2023):
Am I correct in the assumption, that this is already implemented using
ROUTER_BASE_PATH, but doesn't get picked up by nuxtjs? (Whis is because nuxt has been compiled to static files)I am happy to help here in any way possible. Just checking the desired behavior here: Do you intend to solve this inside the server code, or do you want to change the nuxt target type?
@advplyr commented on GitHub (Apr 22, 2023):
Correct. The server side part should be good to go although I haven't tested that env variable in a while.
I'm not sure what the best way to solve it is. My initial thought is that we have the server build Nuxt programmatically. I haven't spent a lot of time looking at the internals of Nuxt but there is some info about this approach https://nuxtjs.org/docs/internals-glossary/nuxt/.
I would really appreciate your help or feedback if you want to dig into any of this. I'm also active on the Discord/Matrix servers if you want to chat about it.
@advplyr commented on GitHub (Apr 22, 2023):
I took a non-traditional approach when first setting this up because I tend to learn as I build, so I just didn't know at the time.
@1nVitr0 commented on GitHub (Apr 22, 2023):
Thats the best way to learn things, at least for me. Give me a few days to fiddle aroundwith it, haven't used nuxt in a while. Given the amount of free time currently, it will probably be a bit hacky, bu I'll make sure it's robust (That is if I manage to find one).
This is an amazing project, I spend 2+ hours a day listening to audibooks. So I will definitely invest more time into this in the future.
@1nVitr0 commented on GitHub (Apr 24, 2023):
Right. After a little fiddling and digging through nuxtjs changelogs, I have come to the following conclusion:
I think they all have their pros and cons
i.is robust and includes minimal code changes, but bloats the docker image with nuxt dependencies and drastically slows down startup. Also depending on the nuxt dependencies, it might struggle with cross-platformii.is robust, efficient and doesn't bloat the docker image very much, as nuxtjs can compile it's dependencies into the build. But it requires some drastic code changes, as we can no longer rely on the static serving of files to detect the request's targetsiiiis robust, efficient and doesn't bloat the docker image very much, as nuxtjs can compile it's dependencies into the build. But it requires some code changes, as nuxt is used as a middleware, this might also need some work when running the client independentlyiv.requires minimal code changes, is very efficient and minimally impacts startup performance. But it relies on nuxt compiling into a known structure and may break when updating to a new versionI am currently dabbling with
iv.as a temporary solution. That does seem to work until the login screen, after which my version currently crashes. (It does not connect to the websocket, so that may be the issue). For a permanent solution, I think eitheri.iioriii.are fine, although I personally lean towardsiii./iiasnodeis used for the rest of the application anyways.ii.would give somewhat more freedom when running client and server independently,iiimight be easier to integrate into express and only runs as a single instance.Update
I have gotten around the issues with crashing my client when manually updating paths. I am currently working on running and accessing the socket under the given base path.
@Danathar commented on GitHub (Jul 2, 2023):
I'd like to present an additional use case, which is how I use it although it seems that everyone already supports the idea. I currently use Nginx's reverse proxy with different subfolder paths to distinguish between Apache Guacamole (a remote desktop app over the web that also utilizes websockets) and Wetty (a web-based terminal). I would prefer to use a subfolder URL for Audiobookshelf, as it would eliminate the need to obtain another certificate for an additional subdomain. I use Let's Encrypt for my certificates which makes the process of obtaining and managing certificates relatively simple and automated. However, having fewer certificates to manage would still simplify the process.
@sandreas commented on GitHub (Jul 2, 2023):
A little off-topic: You could use letsencrypt wildcard certificates (
*.domain.com), which work perfectly fine on my system.@Danathar commented on GitHub (Jul 3, 2023):
Yea I guess it’s slightly off topic. I forgot to use wildcard certs when I first setup my system. I don’t think it’s trivial to convert once you have gone down the road of individual certs. I think I would need to revoke all my certs and start over.
@MagiX13 commented on GitHub (Jul 15, 2023):
I could be entirely wrong here as I never worked with anything from the underlying stack, but isn't this supported in nuxt using the runtime config, as described with basically the exact example here
Giving a bit more context on the runtime config from here
@advplyr commented on GitHub (Jul 15, 2023):
@MagiX13 That is for axios and not for nuxt which is generating all the paths during build. There is a detailed discussion in #1746
@gardiol commented on GitHub (Mar 26, 2024):
Is there any news on this? I would also like this feature if not yet implemented.
@gaarysn commented on GitHub (May 20, 2024):
Hi. What shoud I do if my server already have subdomain (like srv.server.com). How to configure nginx and ssl to audiobookshelf.srv.server.com? Will audiobookshelf work like this?
@Danathar commented on GitHub (May 20, 2024):
Create a server block in nginx like:
You could set that listen to whatever you like, but if you use 443 you'll need to set up certs. I set mine up with letsenrypt. The block above was spit out by AI, but it's similar to mine except I've added encryption.
@farfalleflickan commented on GitHub (Jun 18, 2024):
@1nVitr0 I do not mean to nag, but would it be possible to know the progress status on this?
@mikiher commented on GitHub (Oct 19, 2024):
I added a small writeup in discussion #3535 to lay out my plan for supporting this within the current codebase.
I already have this mostly working on my dev environement, but I wanted to solicit some feedback before I continue, since the changes I'm suggesting are somewhat subtle.
@4ch1m commented on GitHub (Nov 15, 2024):
After reading all the comments it's pretty obvious that this issue is a hard nut to crack. 😄
However, this also seems to be the most requested feature at the moment.
And although partial progress has been reported, plus @mikiher already compiled a very helpful gist... I'm still confused. 🤯
So... is anyone still actively working on this? 🤔
I don't want to be impatient or demanding.
I'm just asking to avoid that someone interested (and maybe skilled) is hesitating to tackle the issue based on the false assumption that someone else is already half-way there.
Thanks!
@mikiher commented on GitHub (Nov 15, 2024):
I am working on it, and it is indeed a bit of a hard nut to crack, as you say (as you may have seen there was some additional discussion in #3535 which complicated things a bit more).
I was side-tracked a bit by some other crash-causing issue I need to deal with first.
I'll definitely get back to this one once I'm done (this isn't meant to ward off anyone who may want to tackle this on their own). I estimate it will take me an additional couple of weeks to complete.
@4ch1m commented on GitHub (Nov 15, 2024):
Thanks for bringing us up to speed, @mikiher.
That's great to hear and much appreciated. 🙇
I would have tried my luck if no one else was working on it.
But I guess it would take me more than just a couple of weeks. 😏
Let me know if you need support for testing your work/implementation.
@iamckun commented on GitHub (Dec 19, 2024):
this nice,What's the latest
@mikiher commented on GitHub (Jan 9, 2025):
I submitted PR #3810 for review to enable subdirectory support.
Once this makes it to the server release, subdirectory access will be enabled on both server and web client.
Subdirectory support for the mobile app will also be enabled on the next mobile app release (audiobookshelf-app PR #1417).
@github-actions[bot] commented on GitHub (Jan 20, 2025):
Fixed in v2.18.0.
@iamckun commented on GitHub (Jan 20, 2025):
/textures/wood_default.jpg 404
@mikiher commented on GitHub (Jan 20, 2025):
@iamckun Thanks for reporting. Just sent a fix for review.
@mikiher commented on GitHub (Jan 20, 2025):
A few notes for on subdirectory support, for those who have not read #3535:
/audiobookshelf/audiobookshelfaccess./audiobookshelf/audiobookshelfaccess. To connect to a server using/audiobookshelf, Add a new server with addresshttps://<your-server-domain-and-port>/audiobookshelfPlease let me know here if you encounter any issues with this.