Login redirect one / too many #2767

Closed
opened 2026-02-05 05:07:48 +03:00 by OVERLORD · 5 comments
Owner

Originally created by @XDjackieXD on GitHub (May 1, 2022).

Describe the Bug

When clicking a link someone sent me, I got redirected to a wrong URL after login.
For example when following a link https://bookstack.example.org/books/blafoo/page/bar I get redirected to the SAML login, I log in and get redirected back to https://bookstack.example.org//books/blafoo/page/bar.
As there is one / too many, I get presented a 404 Page. When clicking the same link again now that I'm logged in everything is working correctly.

I updated bookstack yesterday to the latest stable (v22.04) from a rather old version (not sure which one it was but it was quite a few months old) and the issue was not happening before the upgrade.

Steps to Reproduce

  1. Setup BookStack 22.04 with SAML login
  2. Log out of bookstack if logged in (you don't need to log out from your SAML IdP)
  3. Click a link to a valid page
  4. Log in
  5. Get redirected to a page containing two slashes in between the base URL and the path and get presented a 404
  6. Click the same link again
  7. See the correct page

Expected Behaviour

Get redirected to the same URL I originally clicked after login.

Screenshots or Additional Context

No response

Browser Details

Firefox 100.0b9 on Linux, also reported by one user running Chrome on Windows

Exact BookStack Version

v22.04

PHP Version

7.4

Hosting Environment

Ubuntu 18.04.6 in a Proxmox (LXC) Container with NGINX and PHP-FPM 7.4 with the exact same NGINX config snippet from the BookStack installation documentation.

Originally created by @XDjackieXD on GitHub (May 1, 2022). ### Describe the Bug When clicking a link someone sent me, I got redirected to a wrong URL after login. For example when following a link `https://bookstack.example.org/books/blafoo/page/bar` I get redirected to the SAML login, I log in and get redirected back to `https://bookstack.example.org//books/blafoo/page/bar`. As there is one `/` too many, I get presented a 404 Page. When clicking the same link again now that I'm logged in everything is working correctly. I updated bookstack yesterday to the latest stable (v22.04) from a rather old version (not sure which one it was but it was quite a few months old) and the issue was not happening before the upgrade. ### Steps to Reproduce 1. Setup BookStack 22.04 with SAML login 2. Log out of bookstack if logged in (you don't need to log out from your SAML IdP) 3. Click a link to a valid page 4. Log in 5. Get redirected to a page containing two slashes in between the base URL and the path and get presented a 404 6. Click the same link again 7. See the correct page ### Expected Behaviour Get redirected to the same URL I originally clicked after login. ### Screenshots or Additional Context _No response_ ### Browser Details Firefox 100.0b9 on Linux, also reported by one user running Chrome on Windows ### Exact BookStack Version v22.04 ### PHP Version 7.4 ### Hosting Environment Ubuntu 18.04.6 in a Proxmox (LXC) Container with NGINX and PHP-FPM 7.4 with the exact same NGINX config snippet from the BookStack installation documentation.
OVERLORD added the 🐛 Bug label 2026-02-05 05:07:48 +03:00
Author
Owner

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

Hi @XDjackieXD,
I did make some changes in v22.04 that could cause a change in such scenario, but I was hopeing they would not affect existing scenarios.

Could you confirm the following to me:

  • Do you have an APP_URL set in your .env file (Within the root of your BookStack install directory).
    • If so, does this have a trailing slash?
@ssddanbrown commented on GitHub (May 2, 2022): Hi @XDjackieXD, I did make some changes in v22.04 that could cause a change in such scenario, but I was hopeing they would not affect existing scenarios. Could you confirm the following to me: - Do you have an `APP_URL` set in your `.env` file (Within the root of your BookStack install directory). - If so, does this have a trailing slash?
Author
Owner

@XDjackieXD commented on GitHub (May 2, 2022):

Thanks for the quick response!
Yes I have APP_URL set and it does not have a trailing slash (the line looks like APP_URL=https://bookstack.example.org)

@XDjackieXD commented on GitHub (May 2, 2022): Thanks for the quick response! Yes I have `APP_URL` set and it does not have a trailing slash (the line looks like `APP_URL=https://bookstack.example.org`)
Author
Owner

@ssddanbrown commented on GitHub (May 4, 2022):

Thanks @XDjackieXD and sorry for my slow follow-up.

I did manage to replicate this issue in my environment and I've just released BookStack v22.04.1 which primarily intends to address this.
I'm apprehensive to close this off though, due to potential environment differences, so could you test things out on that latest version and let me know if this is solved for you?

@ssddanbrown commented on GitHub (May 4, 2022): Thanks @XDjackieXD and sorry for my slow follow-up. I did manage to replicate this issue in my environment and I've just released [BookStack v22.04.1](https://github.com/BookStackApp/BookStack/releases/tag/v22.04.1) which primarily intends to address this. I'm apprehensive to close this off though, due to potential environment differences, so could you test things out on that latest version and let me know if this is solved for you?
Author
Owner

@XDjackieXD commented on GitHub (May 5, 2022):

I can confirm it is working as intended now.
Thank you very much for the quick fix!

@XDjackieXD commented on GitHub (May 5, 2022): I can confirm it is working as intended now. Thank you very much for the quick fix!
Author
Owner

@ssddanbrown commented on GitHub (May 5, 2022):

@XDjackieXD Awesome! Thanks for confirming.

@ssddanbrown commented on GitHub (May 5, 2022): @XDjackieXD Awesome! Thanks for confirming.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/BookStack#2767