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

Prevent redirects when query string changes but cache key is the same #18

Closed
wants to merge 1 commit into from

Conversation

roborourke
Copy link

Sometimes redirect_canonical() will recreate the query string and reformat it in the process. The end URL and result will be the same but the URLs do no match and so a redirect occurs. If Batcache caches this redirect then it will get the same cache key for URL formatted by redirect_canonical() and go into an endless redirect loop.

This change resolves the problem by preventing a redirect in the case described.

Sometimes `redirect_canonical()` will recreate the query string and reformat it in the process. The end URL and result will be the same but the URLs do no match and so a redirect occurs. If Batcache caches this redirect then it will get the same cache key for URL formatted by `redirect_canonical()` and go into an endless redirect loop.

This change resolves the problem by preventing a redirect in the case described.
Copy link

@hm-linter hm-linter bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Linting failed (512 errors).

(498 notices occurred in your codebase, but were on files/lines not included in this PR.)

@roborourke
Copy link
Author

Fixing this upstream in Altis CMS instead, additionally going to fix in WP core per https://core.trac.wordpress.org/ticket/41712

@roborourke roborourke closed this Jan 11, 2021
@roborourke roborourke deleted the add-maybe-redirect branch January 11, 2021 13:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant