Prerendering for Single Page Apps

This feature is in beta.

If you’re using a single page app for a site that’s not behind a login, SEO is an important concern.

Google, Bing, Yandex and other search engines and crawlers support Google’s standard for Ajax Crawling.

Normally Google will penalize sites heavily for using “Cloaking”, ie. showing different content to Google than to normal web visitors, but for single page apps they have an exception. When detecting a single page app their crawler will send an _escaped_fragment_ query parameter in the request, and the origin server can then choose to return a document that represents the content a user will actually see when the single page app is running.

Note: Google recently marked their Standard for Ajax Crawling as deprecated. They’re still following the standard, but recommend that single page app authors just rely on Google’s built-in capacity for interpreting JavaScript applications. In our experience that’s often still not enough and prerendering is often still a necessity.

Setting up Prerendering

Netlify comes with built-in prerendering. Enabling it is as simple as checking a box:

Enabling netlify's built-in prerendering

Our built-in prerendering service will cache prerendered pages for between 24 and 48 hours; this is not adjustable.

Team accounts may also use external prerender services that can automate this for you:

Prerender.io has an open-source version of their service that you can self-host.

If you want to use an external service, transfer your site to a team, send us a mail at team@netlify.com to let us know which service you’re using and its API token, and we’ll get you set up.

How it works

We’ve taken great care to implement support for prerendering in the most efficient manner possible.

When a request hits one of our CDN servers, our CDN software determines if it’s a prerendering request from a crawler. If prerendering is enabled for your site, our cache servers will contact the prerendering backend straight from our CDN nodes instead of serving the normal cached request.

If your prerendering backend makes good use of HTTP caching headers like max-age, ETags or Last-Modified dates, prerendered responses will be cached sensibly on our CDN edge nodes. In our initial tests we’ve seen average response times of ~100ms to crawlers, which is low enough that Google will still give your site a SEO boost for being fast.


Notice something is incorrect or outdated?

First off, great eye! We appreciate your discovery and want to ensure it gets addressed immediately. Please let us know here.

Want to get started quick?