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

Listing view toggle redirects do not take APP_URL into account #1459

Closed
nekromoff opened this issue May 23, 2019 · 11 comments

Comments

@nekromoff
Copy link

commented May 23, 2019

Describe the bug
e.g.: /books/faktur%c3%a1cia?shelf=2

Steps To Reproduce
Steps to reproduce the behavior:

  1. Create URL with extended ASCII chars
  2. URLs not working after upgrade
    Expected behavior
    URL working after upgrade

Screenshots
If applicable, add screenshots to help explain your problem.

Your Configuration (please complete the following information):

  • Exact BookStack Version (Found in settings): 0.26.1
  • PHP Version: 7.2
  • Hosting Method (Nginx/Apache/Docker): Apache

Additional context
Add any other context about the problem here.

@nekromoff

This comment has been minimized.

Copy link
Author

commented May 23, 2019

OK, I can now narrow the bug to the List View, where on the homepage query parameter is added, such as:
books/administrat%C3%ADva/?shelf=2

These URLs are all broken with 404 pages.

@ssddanbrown

This comment has been minimized.

Copy link
Member

commented May 25, 2019

Hi @nekromoff,

Just tried to re-produce this but without success.
Are you able to reproduce this issue on the BookStack demo instance?

@nekromoff

This comment has been minimized.

Copy link
Author

commented Jun 6, 2019

.htaccess:

<IfModule mod_rewrite.c>
    <IfModule mod_negotiation.c>
        Options -MultiViews
    </IfModule>

    RewriteEngine On

    # Redirect Trailing Slashes If Not A Folder...
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)/$ /$1 [L,R=301]

    # Handle Front Controller...
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^ index.php [L]
</IfModule>

List view enabled, any click to books will lead to:

URL:
image

image

@nekromoff

This comment has been minimized.

Copy link
Author

commented Jun 6, 2019

OK, I have identified the problem.

Existing serving directory is:
domain.com/wiki/public/books/...

I get redirected to:
domain.com/books/...

So, there is issue with that.

.env:

APP_URL=https://domain.com/wiki/public
@ssddanbrown

This comment has been minimized.

Copy link
Member

commented Jun 6, 2019

@nekromoff Do other URL's in the application work? or is it just the books listing?

Just as a warning, since you've got public in your APP_URL, If you're serving BookStack as a sub-folder of another website, this will probably be insecure since many more files would be exposed to the web server than should be.

Documentation for this kind of set-up can be found in the docs here: https://www.bookstackapp.com/docs/admin/subdirectory-setup/

@nekromoff

This comment has been minimized.

Copy link
Author

commented Jun 6, 2019

@ssddanbrown

This comment has been minimized.

Copy link
Member

commented Jun 6, 2019

@nekromoff Ah, Okay, So it's only on view change?

If so I'll update the original issue title since this sounds like it's become something different.

@nekromoff

This comment has been minimized.

Copy link
Author

commented Jun 6, 2019

It has become something else, sorry for the misleading start, I have only pinpointed the exact issue recently.

@ssddanbrown

This comment has been minimized.

Copy link
Member

commented Jun 6, 2019

@nekromoff No worries, I'll update the title. Think I can see where this is caused, Will mark for next release to ensure it's looked at.

Just as an added note, please check your setup as per my earlier comment. If you can go to https://www.domain.com/wiki/.env and the browser downloads your .env file then that's a big concern.

@ssddanbrown ssddanbrown changed the title URLs with diacritics stopped working after the latest upgrade Listing view toggle redirects do not take APP_URL into account Jun 6, 2019

@ssddanbrown ssddanbrown added the 🐛 Bug label Jun 6, 2019

@ssddanbrown ssddanbrown added this to the v0.27.0 milestone Jun 6, 2019

@nekromoff

This comment has been minimized.

Copy link
Author

commented Jun 6, 2019

@ssddanbrown

This comment has been minimized.

Copy link
Member

commented Aug 4, 2019

Significant changes have been made to URL generation in 4b0c4e6 which should now fix this. I have tested this scenario on a development instance and it appears to work but this kind of thing can be setup/system dependant.

These changes will be in the next release, v0.27. I will close this request in the meantime. If you continue to experience issues after that version is released please open a new issue referencing this one.

@ssddanbrown ssddanbrown closed this Aug 4, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
2 participants
You can’t perform that action at this time.