Skip to content
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

Startpage will not be set #3361

Closed
AndreasPantle opened this issue Apr 1, 2022 · 3 comments
Closed

Startpage will not be set #3361

AndreasPantle opened this issue Apr 1, 2022 · 3 comments
Labels

Comments

@AndreasPantle
Copy link

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

@ssddanbrown
Copy link
Member

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?

@AndreasPantle
Copy link
Author

@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

@ssddanbrown ssddanbrown added this to the v22.03.2 milestone Apr 2, 2022
@ssddanbrown
Copy link
Member

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 ssddanbrown removed this from the v22.03.2 milestone Apr 24, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

No branches or pull requests

2 participants