Replies: 4 comments 8 replies
-
Just to clarify, if this is implemented and I'm using a subdomain say and I navigate to the Nuxt client will redirect me to |
Beta Was this translation helpful? Give feedback.
-
I want to be very precise about my answer: Case 1:
So unless express.static() logic decides to redirect (as in this case), there will be no actual http redirect involved, just path rewrites. Case 2: So the bottom line answer is that either way there's usually no actual HTTP redirect involved. just path rewrites. So when I said "Nuxt will redirect to the subdirectory path." it was mostly a figure of speech, not a precise statement. |
Beta Was this translation helpful? Give feedback.
-
I think this is a good solution. One of the unknowns I have so far is what will need to be updated for the OIDC authentication. @Sapd put all that logic together but I can see the redirect URIs would need to be updated Lines 714 to 716 in d80752c Also, when creating RSS feeds we store the full server URL. In the |
Beta Was this translation helpful? Give feedback.
-
Thank you both for you comments. I'll address them in upcoming PRs. |
Beta Was this translation helpful? Give feedback.
-
During a recent discussion on the reasons for moving to SSR, issue #385 came as one of the reasons.
Background
In a nutshell, issue #385 requests an ability to have a server that supports reverse-proxied subdirectory requests, i.e. supporting external requests like
https://my.domain.com/audiobokshelf
instead ofhttps://audiobookshelf.my.domain.com
. The latter (aka subdomain proxy) is the standard and recommended reverse-proxy setup for Audiobookshelf, but the former (aka as subdirectory proxy) is not supported.The main difference between the two, which currently makes supporting subdirectory proxy harder, is that when you use a subdomain proxy, it doesn't affect server routes, but with a subdirectory proxy, the server needs to account for the subdirectory when generating its responses - all the paths in URLs that are referenced in the HTML and Javscript rendered by the server need to account for that subdirectory. In Audiobookshelf, the problem is compounded by the fact that we statically serve the web client (aka SSG) - in an SSR framework, all the paths can be generated dynamically at runtime, but we don't currently support SSR.
In a discussion on Discord, I suggested that since the server and the web client already seemed to support subdirectory serving through the ROUTER_BASE_PATH environment variable, then a workaround for those who need a subdirectory proxy would be:
/audiobookshelf
)https://my.external.domain.com/audiobookshelf
tohttp://<server-address>:<server-port>/audiobookshelf
And with that, they'd have a working workaround solution.
I also noted that we could build and provide a separate docker image with ROUTER_BASE_PATH=/audiobookshelf for those who needed it.
@advplyr said he was OK with implementing the workaround, but he asked that we try to come up with a solution that does not require building and maintaining an additional docker (and debian) image.
Objectives
So based on these, here's a summary of the objectives:
Suggested solution
The suggestion, in a nutshell, is to switch the server to always use a static non-empty ROUTER_BASE_PATH
/audiobookshelf
.To support subdirectory access (
https://my.domain.com/audiobookshelf
):https://my.external.domain.com/audiobookshelf
).To support non-subdirectory access (
https://audiobookshelf.my.domain.com
, for existing mobile and third-party clients):https://audiobookshelf.my.domain.com
)./audiobookshelf
should be rewritten to start with/audiobookshelf
/audiobookshelf/socket.io
(already implemented in Fixes and cleanup for subdirectory serving support #3521), we need to support it at/socket.io
as well (for existing clients).The docker image and the debian package will be updated to always set ROUTER_BASE_PATH to
/audiobookshelf
.Implications:
/audiobookshelf
entrypoint on the server, as it would conflict with the subdirectory path. This doesn't seem to be a problem, as we don't currently have any such entrypoint.Beta Was this translation helpful? Give feedback.
All reactions