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

hidden prefix redirection when locale cookie exist issue fixed #837

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

HasanQQ
Copy link

@HasanQQ HasanQQ commented Aug 18, 2022

When "hideDefaultLocaleInURL" is true and we also want to use LocaleCookieRedirect middleware there is an issue happen. If users change their language with visiting prefixed route other than default locale (ex. https://example.com/es/foo-bar) then they want to revert again to the default language with visiting default prefixed (ex. https://example.com/en/foo-bar - en is default) route, LocaleCookieRedirect middleware redirecting them to "https://example.com/es/foo-bar" because of locale cookie (it's still "es"). So I added some rows to LaravelLocalizationRedirectFilter middleware for locale cookie update.

Also I change the http status code from 302 to 301 for this redirection because of this both page exactly the same (for SEO) and add "Pragma: no-cache" header for prevent browser cache issues.

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.

1 participant