Desktop vs. mobile

Most websites using Prerender.io don't have issues with mobile vs desktop crawlers because they are responsive. If your website is adaptive and you serve a different page to desktop vs mobile viewports, then we can turn on a feature for your account to save a desktop and mobile page separately. Once we turn on the mobile adaptive feature we will send over the original crawler user agent and viewport size when we render your pages. Since we send the original crawler user agent through, you will need to modify your middleware before we can turn on the mobile adaptive feature for your account.

Keep in mind that if we turn on mobile adaptive for your account, you can have up to 2X more pages cached since we can save a mobile and a desktop version of the page.

If you have determined that your page needs our mobile adaptive feature, depending on the middleware you are using, you might need to modify your middleware. Your middleware will need to check for the "X-Prerender:1" header that we send on our browser so that the requests from our Prerender browser (with a crawler user agent) don't get sent through to Prerender.io in a loop.

To test if your middleware is already checking for the X-Prerender:1 header, you can easily test with the following curl commands:

This should return your normal HTML page with script tags

shell curl https://www.example.com/

This should return your prerendered page without script tags

shell curl -A Googlebot https://www.example.com/

This should return your normal HTML page with script tags if the X-Prerender header is being checked properly

shell curl -A Googlebot -H "X-Prerender:1" https://www.example.com/

If the above curl commands return the expected content, then send us an email at support@prerender.io with a URL we can test, your email or API token for the account you want turned on and we can work on getting that setup for you as soon as possible!

How to setup your middleware to check for X-Prerender:1 if needed:

If the above curl commands did not work as expected, you will need to modify your middleware to check for the X-Prerender:1 header.

For example, if you are using Nginx you will want to add this to your Prerender.io config:

if ($http_x_prerender = "1") { set $prerender 0; }

Let us know if you are using a different middleware and would like us to show you how to set that up.

Once you have this set up, send us an email at support@prerender.io with a URL we can test, your email or API token for the account you want turned on and we can work on getting that setup for you as soon as possible!

Did this answer your question? Thanks for the feedback There was a problem submitting your feedback. Please try again later.