question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[bug]: 404 pages don't return 404 status code

See original GitHub issue

Describe the bug

If the visitor enters a non existing URL, the network requests returns a 200 StatusCode while showing the Magento no route page. However it should return a 404 StatusCode

To reproduce

Steps to reproduce the behavior:

  1. Go to venia.magento.com/venia-bottoms/venia-pants.html?page=1
  2. Open your Inspect tool
  3. Go to the network tab
  4. Change the URL to https://venia.magento.com/venia-bottoms/venia-pantsblabkla
  5. venia-pantsblabkla returns statusCode 200

Expected behavior

venia-pantsblabkla should return a statuscode 404, which would be consistent with thee 404 page shown by Magento

Screenshots

https://snipboard.io/iowkIO.jpg

Please complete the following device information:

Issue happens on all devices and all Magento PWA Studio versions

Please let us know what packages this bug is in regards to:

  • venia-concept
  • venia-ui
  • pwa-buildpack
  • peregrine
  • pwa-devdocs
  • upward-js
  • upward-spec
  • create-pwa

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
vrielsacommented, May 9, 2022

@anthoula even if this is expected behavior, wouldn’t it harmful for SEO scores when using PWA Studio? I cannot Imagine crawlers liking a status 200 whilst the page content clearly states its not found.

The way I understand it, is that upward resolves the route and during component render the call goes out to ResolveURL. Which, imho, is actually to late, because at that point we’d already gotten a 200. Wouldn’t it make more sense to call ResolveURL during in a middleware thats baked in upward (as far as I see upward uses express, so technically that should be possible to do)?

0reactions
azngeekcommented, Jun 1, 2022

This is def. something which is not optimal for SEO. Google might identify those pages as “soft 404” but honestly this is something which is not an expected behaviour for a crawler. Would this be in https://github.com/magento/pwa-studio/blob/develop/packages/upward-js/lib/resolvers/UrlResolver.js ?

Read more comments on GitHub >

github_iconTop Results From Across the Web

404 vs. Soft 404 Errors: What's The Difference & How To Fix ...
To summarize, the 404 page not found code means there was an error in the browser request because the requested page could not...
Read more >
Error 404 not found - What does it mean & how to fix it! - IONOS
Something along the lines of '404 Not Found'. A 404 error is the standardized HTTP status code. The message is sent from the...
Read more >
404 Pages Should Not Return 200 Status Codes
If you return a 404, it technically means the page does not exist. If you return a 301, then you say that page...
Read more >
How to Fix Error 404 Not Found on Your WordPress Site - Kinsta
The 404 (Not Found) status code indicates that the origin server did not find a current representation for the target resource or is...
Read more >
How to Find and Fix 404 Errors - Neil Patel
A 404 error is a code that indicates a requested page cannot be found. Whenever a page loads in a browser, it has...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found