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

Support for forcing HTTP status code through HTML (for SPA) #38

Open
rrjanbiah opened this issue Sep 25, 2020 · 8 comments
Open

Support for forcing HTTP status code through HTML (for SPA) #38

rrjanbiah opened this issue Sep 25, 2020 · 8 comments

Comments

@rrjanbiah
Copy link

Since, SPA handles 404 pages in the client side, it needs a mechanism to handle HTTP status code through HTML

For example, https://github.com/GoogleChrome/rendertron#status-codes provides below syntax to pass HTTP status code from HTML:

<meta name="render:status_code" content="??" />

FWIW, tagging active fork authors in case if they have better solution implemented in their fork. @PureLandFlying @plan-my-binge @muhammadmuhlas @mehdipourfar

@muhammadmuhlas
Copy link

Hi @rrjanbiah

It's a common case when returning 404 on SPA pages. You need to configure something like _redirects on netlify, or use try_files on nginx. You should see that on the deployment guide of your SPA.

@muhammadmuhlas
Copy link

Oh sorry, did you mean that rendora should look up on the meta tags about the http codes of the rendered pages instead of always returning 200?

@rrjanbiah
Copy link
Author

@muhammadmuhlas

Oh sorry, did you mean that rendora should look up on the meta tags about the http codes of the rendered pages instead of always returning 200?

Yep, exactly. Similar to Rendertron https://github.com/GoogleChrome/rendertron#status-codes, it should support

<meta name="render:status_code" content="??" />

@muhammadmuhlas
Copy link

It is possible to using strings.Contains on get HTML Markup after wait after DOM load

@rrjanbiah
Copy link
Author

It is possible to using strings.Contains on get HTML Markup after wait after DOM load

@muhammadmuhlas Thanks for your suggestion.

@muhammadmuhlas
Copy link

@rrjanbiah you could also use regex to get the code, but becareful using regex on html response, the cost could be expensive.

@rrjanbiah
Copy link
Author

@rrjanbiah you could also use regex to get the code, but becareful using regex on html response, the cost could be expensive.

Thank you so much for your help

@rrjanbiah
Copy link
Author

Side note: if anyone reached here through Google search

  1. Google seems to handle the 'Soft 404' correctly. Tested with g.co/mobile-friendly
  2. For angular.io website, Google itself is handling 'Soft 404' it through noindex meta tag. As noted by https://stackoverflow.com/questions/35989950/how-to-notify-googlebot-about-404-pages-in-angular-spa/61700000#61700000
  3. Yet, Rendertron like approach would be a cool feature for Rendora

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

No branches or pull requests

2 participants