BookStackApp / BookStack

A platform to create documentation/wiki content built with PHP & Laravel
https://www.bookstackapp.com/
MIT License
14.81k stars 1.86k forks source link

[Bug Report]: Getting a 404 on login page since 21.11 #3095

Closed rparree closed 2 years ago

rparree commented 2 years ago

Describe the Bug

I tried updating to version 21.11.2, but when accessing the site and it redirects to /bookstack/login it shows "Page Not Found".

Bookstack is running in kubernetes and i am using the linuxserver images. From a few tests i found out:

does not work

ghcr.io/linuxserver/bookstack:version-v21.11 ghcr.io/linuxserver/bookstack:version-v21.11.2 ghcr.io/linuxserver/bookstack:version-v21.11.3

works

ghcr.io/linuxserver/bookstack:version-v21.10.1 ghcr.io/linuxserver/bookstack:version-v21.10.3

thanks.,

Steps to Reproduce

change version from 21.10.x to 21.11.x

Expected Behaviour

Login page to be displayed

Screenshots or Additional Context

No response

Exact BookStack Version

21.11

PHP Version

No response

Hosting Environment

kubernetes with istio.

ssddanbrown commented 2 years ago

Hi @rparree,

I tried updating to version 21.11.2, but when accessing the site and it redirects to /bookstack/login it shows "Page Not Found".

rparree commented 2 years ago

I am hosting on /bookstack, the APP_URL includes the full : https://xxx.yyyy.com/bookstack

tx.,

ssddanbrown commented 2 years ago

Thanks for confirming @rparree. Do you have any detail on how requests are sent to the linuxserver container? Are you using a standard reverse proxy? If so can you share the configuration used?

rparree commented 2 years ago

I am using istio's virtualservice.

This works fine up to version v21.10.1. I should also mention that the "not found" page is the styled one from bookstack. Meaning its css assets etc are successfully fetched

apiVersion: networking.istio.io/v1alpha3
kind: VirtualService
metadata:
  name: bookstack
spec:
  hosts:
    - xxxx.yyyy.com
  gateways:
    - kube-system/gw-public
  http:
    - route:
        - destination:
            host: bookstack-0
            port:
              number: 80
      match:
        - uri:
            prefix: /bookstack
      rewrite:
        uri: /
Perrydiculous commented 2 years ago

I am well aware that this is very basic, and I don't have any experience with your setup, mine's very different, so I'm not thinking I'm brilliantly providing a definite fix here... It's just that I had this exact same problem, couldn't find the cause, and a seemingly random chain of artisan commands fixed it:

php artisan config:clear
php artisan cache:clear
php artisan view:clear
php artisan config:cache
php artisan bookstack:regenerate-comment-content
php artisan bookstack:regenerate-search
php artisan bookstack:regenerate-permissions
php artisan cache:clear
php artisan config:cache
php artisan view:cache

I'm not saying it works and if it does I can't explain why... I just know I was frustrated and mashing 'm in this order which worked... 😂

(this was after having used every single one of those commands once already, btw, since I updated a ton of versions at once, and probably needed them all, except for the cache ones. That's a precaution I'm taking after the cached DB config once didn't clear properly, due to which an update on my staging destroyed my production)

rparree commented 2 years ago

@Perrydiculous thanks for your help. It however did not help. I am still getting the same error on recent versions while it works on 21.10

version 21.10.3

image

for example version 21.11.3:

image

The /bookstack url works for css and js assets, just not for the login page: image

nicolaslopez1989 commented 2 years ago

Dear good afternoon everyone .. I have the same problem when updating from version 21.10.3 to 21.11.3. I get a 404 error when accessing the login screen.

Infrastructure detail: Nginx Reverse Proxy on localhost Docker container with Centos7 image with php 7.3 + apache as application web server DB Mysql to external host.

I applied the mentioned solutions but still without success.

Any ideas?

nicolaslopez1989 commented 2 years ago

Dear good afternoon everyone .. I have the same problem when updating from version 21.10.3 to 21.11.3. I get a 404 error when accessing the login screen.

Infrastructure detail: Nginx Reverse Proxy on localhost Docker container with Centos7 image with php 7.3 + apache as application web server DB Mysql to external host.

I applied the mentioned solutions but still without success.

Any ideas?

I found the solution: The new version rewrites the URL to me. It added a / after the domain and before login.

I understand that it is a problem of my configuration since it did not work for me with version 21.11. Or not. I haven't fully verified it yet.

I hope it will help you.

Greetings!

jakubboucek commented 2 years ago

Same problem :-(

ssddanbrown commented 2 years ago

Just to provide an update, I have tested path-based proxied instances and it's not that alone since my existing dev instances worked fine.

I was able to re-produce this (Although I didn't check against older BookStack versions) in once Apache proxy instance where I found the proxying was causing an extra slash to be added to the path in the request to BookStack. A tweak to the proxy passing got this working fine. Below is an example of the config change I made.

Config Changes ### Broken ```apache ProxyPass "/bs" "http://bookstack.local/" ProxyPassReverse "/bs" "http://bookstack.local/" ``` ### Working ```apache ProxyPass "/bs" "http://bookstack.local" ProxyPassReverse "/bs" "http://bookstack.local" ```
ssddanbrown commented 2 years ago

In v22.04 I made further changes to URL handling related to an issue that was likely connected to this one. Since there was no further progress on this issue thread, and since we've since made further changes, I'm going to close this off. If you're still having issues on the latest release feel free to comment to request this be re-opened.

rparree commented 2 years ago

I checked with the updated version and had the same problem.

I have moved our bookstack to a subdomain instead of path-based. So i am avoiding the problem.

mgueydan commented 1 year ago

Hi everybody.

Just to say I had the same issue, due to the fact that : the mod_redirection was not enabled on my apache.

Apache configuration was correctly protected : <IfModule mod_rewrite.c> ... so rewriting was not made

So I had to enable rewrite module sudo a2enmod rewrite

I assume, that module "mod_negotiation.c" should be enabled too.

Have a nice day.