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

fix: redirect from 404 to defaultLocale if there is matching route #685

Merged
merged 3 commits into from
Apr 30, 2020

Conversation

rchl
Copy link
Collaborator

@rchl rchl commented Apr 24, 2020

fix: redirect from 404 to defaultLocale if there is matching route

Changes the setLocale logic to, in case current route is 404, to
try to find a matching one for current locale. This is for situations
when using prefix strategy where the root (/) route doesn't exist.
We will try to find and redirect to prefixed route matching resolved locale.

Also worked around Nuxt issue (nuxt/nuxt#4491 )
with redirect not working when called from a plugin in SPA mode.
Required for the above fix above to be functional in SPA.

Resolves #677
Resolves #491

Changes the `setLocale` logic to, in case current route is 404, to
try to find a matching one for current locale. This is for situations
when using `prefix` strategy where the root (`/`) route doesn't exist.
We will try to find and redirect to prefixed route matching resolved locale.

Also worked around Nuxt issue (nuxt/nuxt#4491 )
with `redirect` not working when called from a plugin in SPA mode.
Required for the above fix above to be functional in SPA.

Resolves #677
Resolves #491
@codecov
Copy link

codecov bot commented Apr 24, 2020

Codecov Report

Merging #685 into master will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master     #685   +/-   ##
=======================================
  Coverage   99.16%   99.16%           
=======================================
  Files           3        3           
  Lines         120      120           
  Branches       33       33           
=======================================
  Hits          119      119           
  Misses          1        1           

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update ce13a23...fd15e96. Read the comment docs.

@rchl rchl merged commit f688177 into master Apr 30, 2020
@rchl rchl deleted the fix/redirect-to-defaultlocale branch April 30, 2020 06:10
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.

No language redirect with dev with prefix strategy in 'spa' mode Getting ERROR 404 on Google search console
1 participant