How to test your site after you have successfully validated your Prerender integration
  • 06 Mar 2024
  • 2 Minutes to read
  • Contributors
  • Dark
    Light
  • PDF

How to test your site after you have successfully validated your Prerender integration

  • Dark
    Light
  • PDF

Article summary

First things first: we recommend using Chrome.

  1. Open your desired URL

  2. Open Dev tools (CTRL+Shift+J on Windows , Option + ⌘ + J on Mac)

  3. Run command (Control + Shift + P on Windows, Command + Shift + P on Mac) - Show Network Conditions
    1.png

  4. After you have Network Conditions “enabled,” navigate to it, look for “User Agent,” and de-select “Use browser default”.

  5. Select Googlebot from the dropdown list (except if you have modified the pre-defined allow list in your Prerender config, in that case, use a different bot that is allowed in your configuration)

  6. Reload your site

  7. Switch to the Network tab and look for the very first connections header :

2.png

If the response contains “x-prerender-requestid” then you can conclude that Prerender.io is working on your site and serving the request.

Bot validation

If your website has bot validation, it will only allow specific search bot user agents from IP addresses that belong to the service. For example Googlebot user agent is only accepted from Google's ASN. This means that the method explained before will not work and your request will be blocked. However, you can still add a custom user agent to your Prerender integration or simply select one from the integration itself that is not validated the same way.

Based on this guide you can check the bot list included in your Prerender integration or add a new user agent.

After that you can follow the step-by-step guide mentioned above with one difference: instead of selecting Googlebot from the dropdown list, you should add the user agent you selected or added to the integration. Additionally, you have the option to add your favourite SEO tool's crawler's user agent to your integration.

Common Problems:

Are you only getting this?

<html><head></head><body></body></html>

You are probably on Rails or some other framework that uses blocking I/O. You need to switch to a server (like Unicorn or Puma) that lets you start multiple processes or use non-blocking I/O so that there isn’t a deadlock when Prerender tries to render your page on the fly.

Are you still seeing JavaScript and not the static HTML?

In this case, you view the source of your page that should be prerendered, but it looks the same as a non-prerendered page. This usually happens if your middleware or config isn’t high enough in your code to execute it before some other route. Try moving your Prerender middleware configuration higher in your file to see if you can get the Prerender middleware to execute first.

Is your page only partially rendered?

Our Prerender server tries its best to determine when the page is done loading by counting the number of requests in flight. Once the number of requests in flight reaches zero, we wait a short period of time and then save the HTML. If this saves the page too early, you can use our window.prerenderReady flag to notify the server that your page is ready to be saved.

Put this in your HTML:

<script> window.prerenderReady = false; </script>

When we see  window.prerenderReady set to false, we’ll wait until it’s set to true to save the HTML. Execute this when your page will be ready (usually after ajax calls).

window.prerenderReady = true;

Was this article helpful?

What's Next