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 "Page not found" suggested search path #8822

Open
3 tasks done
harrisi opened this issue May 9, 2023 · 9 comments
Open
3 tasks done

Fix "Page not found" suggested search path #8822

harrisi opened this issue May 9, 2023 · 9 comments
Labels
🐛 bug Something isn't working, or isn't working as expected effort: large This task is large effort. idle p3 We don't have visibility when this will be addressed. plus:offline

Comments

@harrisi
Copy link

harrisi commented May 9, 2023

Summary

When a page is not found, a "Page not found" page is served, with a section for suggested search terms by generating links to window.location.pathname.split('/').map(el => `https://developer.mozilla.org/${window.location.pathname.split('/')[1]}/search?q=${el}`).splice(2) (this is obviously not how it's actually done on the server, but just to show what's happening). This is includes the top-most level of the path, which either shouldn't be included in the links generated, as it causes the path to be something like https://developer.mozilla.org/docs/search?q=Quirks%20Mode%20and%20Standards%20Mode, with docs included, whereas the search path is just /search (i.e., top-level).

URL

https://developer.mozilla.org/docs/Web/HTML/Quirks_Mode_and_Standards_Mode

Reproduction steps

  1. Navigate to https://developer.mozilla.org/docs/Web/HTML/Quirks_Mode_and_Standards_Mode
  2. Click on any link in the suggested search section

Expected behavior

Should navigate to https://developer.mozilla.org/en-US/search?q=Quirks%20Mode%20and%20Standards%20Mode

Actual behavior

Navigates to https://developer.mozilla.org/en-US/docs/search?q=Quirks%20Mode%20and%20Standards%20Mode

Device

Desktop

Browser

Firefox

Browser version

Stable

Operating system

Mac OS

Screenshot

No response

Anything else?

No response

Validations

@github-actions github-actions bot added the needs triage Triage needed by staff and/or partners. Automatically applied when an issue is opened. label May 9, 2023
@caugner
Copy link
Contributor

caugner commented May 10, 2023

@harrisi Would you have another example?

For me, the URL you mention redirects to /en-US/docs/..., as it should be:

% curl -i https://developer.mozilla.org/docs/Web/HTML/Quirks_Mode_and_Standards_Mode                                                                                
HTTP/2 302 
cache-control: no-store
location: /en-US/docs/Web/HTML/Quirks_Mode_and_Standards_Mode
vary: Accept
content-type: text/plain; charset=utf-8
date: Wed, 10 May 2023 14:52:17 GMT
server: Google Frontend
content-length: 73
via: 1.1 google
x-cache: miss
alt-svc: clear

Found. Redirecting to /en-US/docs/Web/HTML/Quirks_Mode_and_Standards_Mode

@harrisi
Copy link
Author

harrisi commented May 11, 2023

Interesting. I just tried this with curl and Chrome and I do indeed get redirected to the proper en-US page.

It seems the issue is that I'm logged into MDN Plus on Firefox. I'll look into that more.

@caugner
Copy link
Contributor

caugner commented May 15, 2023

It seems the issue is that I'm logged into MDN Plus on Firefox.

Do you have MDN Offline enabled by any chance?

@harrisi
Copy link
Author

harrisi commented May 24, 2023

Yes, which does seem to be the issue. That seems like a big enough difference in cause to warrant a new issue.

@caugner caugner added 🐛 bug Something isn't working, or isn't working as expected p3 We don't have visibility when this will be addressed. plus:offline and removed needs triage Triage needed by staff and/or partners. Automatically applied when an issue is opened. labels May 25, 2023
@caugner
Copy link
Contributor

caugner commented May 29, 2023

@harrisi This seems to have been fixed with #8846, I can not reproduce it (with MDN Offline enabled). Would you mind trying it again? (I tested with https://developer.mozilla.org/docs/Web/HTML/Quirks)

@harrisi
Copy link
Author

harrisi commented Jun 21, 2023

I'm still seeing this. I tried clearing my cache and getting rid of any local storage, redownloading, and testing again. Tried in a different browser, in private mode, still seeing the issue.

Interestingly, if I sign in in a Safari private window, turn on offline content, and before even downloading the content, navigate to https://developer.mozilla.org/docs/Web/HTML/Quirks_Mode_and_Standards_Mode, I see the issue. If I turn off offline content and go to the address again, it redirects correctly.

I'm still not sure how to even effectively recreate this locally, actually. Any tips on mocking a signed in user, using local storage rather than local web server, etc. would be appreciated.

@caugner
Copy link
Contributor

caugner commented Jun 21, 2023

Thank you for the update. Can you explain how you navigate to https://developer.mozilla.org/docs/Web/HTML/Quirks_Mode_and_Standards_Mode in the first place (and not https://developer.mozilla.org/en-US/docs/Web/HTML/Quirks_Mode_and_Standards_Mode, which would work)?

@harrisi
Copy link
Author

harrisi commented Jun 21, 2023

  1. Open a page that is in quirks mode (or Almost Standards mode) in Firefox (e.g., https://www.quirksmode.org/)
  2. View console output
  3. Click on [Learn More] in console

@caugner caugner added the effort: large This task is large effort. label Oct 12, 2023
@caugner
Copy link
Contributor

caugner commented Oct 12, 2023

Added effort: large, as the only solution I see is to add redirect support to MDN Offline. If we only add the missing locale (ignoring the _redirects.txt in content), then this could be effort: medium.

@github-actions github-actions bot added the idle label Jan 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐛 bug Something isn't working, or isn't working as expected effort: large This task is large effort. idle p3 We don't have visibility when this will be addressed. plus:offline
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants