-
-
Notifications
You must be signed in to change notification settings - Fork 119
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
APP_URL with subdirectories does not work. #261
Comments
Thanks for opening your first issue here! Be sure to follow the relevant issue templates, or risk having this issue marked as invalid. |
Unproxied subfolder isn't really a use case we want to support because it's a very niche requirement and parsing strings and inserting them into configs on anything other than first run risks breaking otherwise functional setups. Out of interest why do you need to run it under a subfolder when you're not proxying the connection? |
I am reverse proxying the connection. I just didn't think it was necessary to add all that complexity when I can demonstrate the problem without having to describe the proxy configuration. I identified this as a solution after hours of trying to get this container to run behind nginx or caddy. Perhaps I am just misunderstanding how I am supposed to reverse proxy this app. I have several others working fine with a simple:
but that didn't work for bookstack until I added the location to bookstack's nginx config. After sleeping on it, I can see that the location block should NOT be unnecessary. But I am at a loss as to why it's not working without it. I am still seeing the /bookstack/ path in the request that hits nginx in the container. here is a log snippet from the container's config/log/nginx/access.log when I hit http://myserver/bookstack/ with the above reverse proxy in place:
Somehow, the /bookstack/ is coming through from the reverse proxy. Surely I don't need to rewrite every request? |
https://www.bookstackapp.com/docs/admin/subdirectory-setup/ suggests that is the case. It's weird, it's like the APP_URL doesn't actually do anything for the main content serving. For comparison, I just setup a test using Traefik to reverse proxy it and I had to do @ssddanbrown can you provide any insight - are we missing something obvious? |
@thespad To just confirm, I wouldn't expect anything to be done for this within the responsibility of this project. I'm not super familiar with caddy, but going by my own video here, I'm guessing this could work for the proxy:
Not tested though. Might need to try without the latter slash and/or remove the |
Subfolder is wonky at the best of times and we try and steer people away from it, in part because different services handle it in different ways. Some will actually serve their content at whatever the base URL is, some will rewrite requests to keep everything internally consistent and some expect the user to do the heavy lifting if they're subfolder proxying. And of course some things just won't work at all on a subfolder. |
Thanks all I got it figured out. I have run into a bit of wonkiness with subhfolders in the past, but 9-10 times it was resolved from within the app/container. I tried "handling" the /bookstack/* path as you describe @ssddanbrown. The nginx logs show that it drops the /bookstack/ in the http referrer, and as a result my browser now reports that the content is "blocked by ORB", and other cross site warnings. But I think you put me on the right path. Reading up on handle it made reference to handle_path which was the key. Here is the caddy configuration that appears to be working for bookstack:
The handle_path directive actually strips the prefix off then hands it over to the reverse_proxy assertion. The funny thing is, the nginx logs inside the container still show that /bookstack/ is in the http referrer (which likely is what fixed the cross site stuff), but it appears that stripping the path was what was required. And here is my docker config for anyone who comes along wondering what worked:
|
Is there an existing issue for this?
Current Behavior
When using an APP_URL that includes subdirectories, all requests get a 404 (not found). The "Page Not Found" page loads with no CSS (giant icons).
This is caused by a lack of a location block in the nginx configuration to handle the subdirectory redirection as described in https://www.bookstackapp.com/docs/admin/subdirectory-setup/#nginx-setup
Expected Behavior
At startup, subdirectory is extracted from the APP_URL provided and a location block is populated with it; allowing the application to work properly when using a reverse proxy with subdirectory.
Steps To Reproduce
Environment
CPU architecture
x86-64
Docker creation
Container logs
The text was updated successfully, but these errors were encountered: