Startpage will not be set #2736

Closed
opened 2026-02-05 04:57:40 +03:00 by OVERLORD · 3 comments
Owner

Originally created by @AndreasPantle on GitHub (Apr 1, 2022).

Describe the Bug

Actually I'm using [v22.03.1]. If I'm changing the start page to Shelves for example it will be set in the database to: settings -> app-homepage-type -> bookshelves. But if I logout and login again I get the message: "Page Not Found". The URL was set to: "http://192.168.99.5/bookstack/bookstack" (My home of BookStack is http://192.168.99.5/bookstack). Then I can press the button "RETURN TO HOME" and I'm getting to the Shelves.
-> I have several instances running on different servers. All the same problem.
-> It is still the same problem if I setup Books as start page.
-> Why is the URL "http://192.168.99.5/bookstack/bookstack" after logging in.
-> If I press the Logo button I'm landing on the correct page.
Do I something wrong here?

Steps to Reproduce

Use v22.03.1
Setup a start page
Logout
Login
You'll get a page "PAGE NOT FOUND"

Expected Behaviour

I think it could be a problem of the redirecting. I expect to be at the correct page.

Screenshots or Additional Context

No response

Browser Details

Chrome

Exact BookStack Version

v22.03.1

PHP Version

7.4

Hosting Environment

several / production sever and virtual server

Originally created by @AndreasPantle on GitHub (Apr 1, 2022). ### Describe the Bug Actually I'm using [v22.03.1]. If I'm changing the start page to Shelves for example it will be set in the database to: settings -> app-homepage-type -> bookshelves. But if I logout and login again I get the message: "Page Not Found". The URL was set to: "http://192.168.99.5/bookstack/bookstack" (My home of BookStack is http://192.168.99.5/bookstack). Then I can press the button "RETURN TO HOME" and I'm getting to the Shelves. -> I have several instances running on different servers. All the same problem. -> It is still the same problem if I setup Books as start page. -> Why is the URL "http://192.168.99.5/bookstack/bookstack" after logging in. -> If I press the Logo button I'm landing on the correct page. Do I something wrong here? ### Steps to Reproduce Use v22.03.1 Setup a start page Logout Login You'll get a page "PAGE NOT FOUND" ### Expected Behaviour I think it could be a problem of the redirecting. I expect to be at the correct page. ### Screenshots or Additional Context _No response_ ### Browser Details Chrome ### Exact BookStack Version v22.03.1 ### PHP Version 7.4 ### Hosting Environment several / production sever and virtual server
OVERLORD added the 🐛 Bug label 2026-02-05 04:57:40 +03:00
Author
Owner

@ssddanbrown commented on GitHub (Apr 1, 2022):

Hi @AndreasPantle,
I can not replicate this error using those steps alone.
I think there's a significant chance that webserver configuration has an impact for this issue.

  • Was this working without issue on a previous version of BookStack? If so, what version?
  • You mention this occurs in several environments, do these share similar configurations and do they all host BookStack on a sub-path?
  • Can you provide more about the server environment where this issue occurs? What webserver is in use? What is the full configuration you have set?
@ssddanbrown commented on GitHub (Apr 1, 2022): Hi @AndreasPantle, I can not replicate this error using those steps alone. I think there's a significant chance that webserver configuration has an impact for this issue. - Was this working without issue on a previous version of BookStack? If so, what version? - You mention this occurs in several environments, do these share similar configurations and do they all host BookStack on a sub-path? - Can you provide more about the server environment where this issue occurs? What webserver is in use? What is the full configuration you have set?
Author
Owner

@AndreasPantle commented on GitHub (Apr 2, 2022):

@ssddanbrown Thank's for your reply.

I was using the same configuration in a previous version. But I don't know which one it was. In the past I reject the usage of BookStack for several use cases (Sorry...). Now there are some improvements that fixes and I can go on with BookStack.

On my servers runs Apache2 / PHP7.4 / MariaDB. I installed BookStack in the folder /usr/share/bookstack/. The Apache config file is:

Alias /bookstack /usr/share/bookstack/public/

<Directory /usr/share/bookstack/public>
    Options Indexes FollowSymLinks
    AllowOverride None
    Require all granted
    <IfModule mod_rewrite.c>
        <IfModule mod_negotiation.c>
            Options -MultiViews -Indexes
        </IfModule>
        RewriteEngine On
        # Handle Authorization Header
        RewriteCond %{HTTP:Authorization} .
        RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
        # Redirect Trailing Slashes If Not A Folder...
        RewriteCond %{REQUEST_FILENAME} !-d
        RewriteCond %{REQUEST_URI} (.+)/$
        RewriteRule ^ %1 [L,R=301]
        # Handle Front Controller...
        RewriteCond %{REQUEST_FILENAME} !-d
        RewriteCond %{REQUEST_FILENAME} !-f
        RewriteRule ^ index.php [L]
    </IfModule>
</Directory>

The bookstack .envfile is:

APP_KEY=xyz
APP_URL=http://192.168.99.5/bookstack
DB_HOST=localhost
DB_DATABASE=bookstack
DB_USERNAME=bookstack
DB_PASSWORD=

The other options are default.

If this is a configuration problem: Yes I have the same issue on a production server and a virtual server at home.

My questions are:

pagenotfound
@AndreasPantle commented on GitHub (Apr 2, 2022): @ssddanbrown Thank's for your reply. I was using the same configuration in a previous version. But I don't know which one it was. In the past I reject the usage of BookStack for several use cases (Sorry...). Now there are some improvements that fixes and I can go on with BookStack. On my servers runs Apache2 / PHP7.4 / MariaDB. I installed BookStack in the folder ```/usr/share/bookstack/```. The Apache config file is: ``` Alias /bookstack /usr/share/bookstack/public/ <Directory /usr/share/bookstack/public> Options Indexes FollowSymLinks AllowOverride None Require all granted <IfModule mod_rewrite.c> <IfModule mod_negotiation.c> Options -MultiViews -Indexes </IfModule> RewriteEngine On # Handle Authorization Header RewriteCond %{HTTP:Authorization} . RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}] # Redirect Trailing Slashes If Not A Folder... RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_URI} (.+)/$ RewriteRule ^ %1 [L,R=301] # Handle Front Controller... RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^ index.php [L] </IfModule> </Directory> ``` The bookstack ```.env```file is: ``` APP_KEY=xyz APP_URL=http://192.168.99.5/bookstack DB_HOST=localhost DB_DATABASE=bookstack DB_USERNAME=bookstack DB_PASSWORD= ``` The other options are default. If this is a configuration problem: Yes I have the same issue on a production server and a virtual server at home. My questions are: * Why is the redirected URL after login **http://192.168.99.5/bookstack/bookstack** and not **http://192.168.99.5/bookstack** ? * I'll see the _Page Not Found_ page. If I press the button _RETURN TO HOME_ it redirects me to the configured start page correctly. This means the link of the button seems to be correct. <img width="1407" alt="pagenotfound" src="https://user-images.githubusercontent.com/13761331/161371881-d66093b9-3b50-4cac-a50f-9b2843459eca.png">
Author
Owner

@ssddanbrown commented on GitHub (Apr 2, 2022):

Thanks for confirming those details. I believe this to be the same as #2765 so I'm going to close this off and have assigned #2765 to be checked again for next feature release.

Why is the redirected URL after login http://192.168.99.5/bookstack/bookstack and not http://192.168.99.5/bookstack ?

It's due to the /bookstack sub path being counted twice when building/detecting the current URL. We do some overrides to URL generation to force the given APP_URL, to fix generation in some environments, but this has issues in environments such as yours.

I'll see the Page Not Found page. If I press the button RETURN TO HOME it redirects me to the configured start page correctly. This means the link of the button seems to be correct.

Links with pre-defined locations, such as this button, are generated without needing guess-work or URL detection, which is what's affecting our dynamic redirects.

@ssddanbrown commented on GitHub (Apr 2, 2022): Thanks for confirming those details. I believe this to be the same as #2765 so I'm going to close this off and have assigned #2765 to be checked again for next feature release. > Why is the redirected URL after login http://192.168.99.5/bookstack/bookstack and not http://192.168.99.5/bookstack ? It's due to the `/bookstack` sub path being counted twice when building/detecting the current URL. We do some overrides to URL generation to force the given `APP_URL`, to fix generation in some environments, but this has issues in environments such as yours. > I'll see the Page Not Found page. If I press the button RETURN TO HOME it redirects me to the configured start page correctly. This means the link of the button seems to be correct. Links with pre-defined locations, such as this button, are generated without needing guess-work or URL detection, which is what's affecting our dynamic redirects.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/BookStack#2736