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

nginx example hdd-cache creates possibility of multiple trailing slashes in url #206

Open
karlkowald opened this issue Mar 4, 2021 · 1 comment
Labels

Comments

@karlkowald
Copy link
Contributor

He, we are using cachify for long time and our prefered method is hdd caching with nginx setup.

works fine but now we found a problem at our server setup, that if we use caching and there is a hit, then its possible that urls could have multiple slashes in URL at the end and its always the same response....
ie:
https://domain.com/the-slug/ is cached...
then those urls all returns the cached site:
https://domain.com/the-slug//
https://domain.com/the-slug///
https://domain.com/the-slug////

Thats naturally not very good for duplicate content resons (although canonical helps there already).

my Quickfix now is this solution above your nginx.conf:

merge_slashes off;
rewrite ^(.*?)//+(.*?)$ $1/$2 permanent;

This lets nginx redirect first the multiple slashes before it searches for cached files on hdd.

perhaps you have a smarter solution for it, pls let me know :)

@derweili
Copy link

This behaviour is not limited to nginx.
It's the same on Apache.

Without the cachify, WordPress automatically redirects to the "single-slash" version.

@Zodiac1978 Zodiac1978 added the bug label Nov 13, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants