-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Redirect i18n URLs that would be valid without the locale prefix #2412
Conversation
I realize that we have some tests for server functionality, so I'll add a new test to this PR to cover the |
✅ Deploy Preview for developer-chrome-com ready!
To edit notification comments on pull requests, go to your Netlify site settings. |
I've added a few tests for the |
Let's merge on Monday, as I would prefer there not to be any surprises with our server code over the weekend 😄 |
I noticed lhci is unhappy, because robots-txt changed location. Let's resolve it before merging. |
Are we sure that LHCI error is legitimate? I don't see a https://developer.chrome.com/robots.txt on the production website, either. Let's chat about it on Monday. |
…me.com into redirect-i18n-404s
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
With the new server logic we return a "404" page for /robots.txt, which is a "malformed" robots file, while previously it was a real native 404.
Simple solution would be to add a robots.txt same as in web.dev
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
404 and 403 open
R: @devnook
CC: @agektmr
Fixes #2398
This shares a similar goal to GoogleChrome/web.dev#7283, but that PR was never merged, and the d.c.c. serving infrastructure differs from web.dev, so I wanted to write something fresh and focused.
The behavior implemented in this PR is:
404
today, check whether replacing the first item in the path with the default locale (en
) would lead to a valid HTML document.404
, return a302
redirecting to the non-localized version of that URL.404
as before.One approach that I considered, but ultimately decided against, was returning the HTML content from the default locale as a
200
response directly from the localized URL, instead of redirecting. That seemed riskier from the point of view of indexing, so I went with a redirect instead.