Closed mgoodfellow closed 10 years ago
Thanks @mgoodfellow . I think i would like to when the prender server throw exception, we can response the really html page(with javascript stuffs).
but so far i am on a business trip, I do not have the .net env.
try{ if(shouldDoPrerender(XXX)){ .............................. } }
Hi @greengerong,
Unfortunately I believe that this behaviour goes against what prerender is trying to accomplish.
Consider the following:
1) Google crawls a page on the site:
GET www.some-website.com/non-existing-page
2) This page doesn't exist and the AngularJS (or other framework) sets the meta tag to tell the prerender server to return a 404 error.
<meta name="prerender-status-code" content="404">
3) The ASP.NET middleware should now handle that 404 (which is returned as a WebException) and pass it onto the crawler.
In the original implementation you describe, the ASP.NET middleware hides the exception and the normal request pipeline is resuming, which in turn means we instead return a 200 to the crawler along with a bunch of JavaScript that it does not run, and the crawler is misled.
Kind regards,
Mike
...iddleware to bomb out, and the normal request pipeline continued. Now the WebException is handled and the correct status code (such as 404 etc.) is passed to the client along with the prerendered content from the server