What prerender_rails does
The gem installs as Rack middleware in a Rails application and watches incoming requests. When a request comes from a crawler such as Google, Bing, Facebook or Twitter, the middleware calls an external Prerender service, which fetches the page, renders the JavaScript, and returns static HTML. That HTML goes back to the crawler in place of the JavaScript page.
The README states that Google is the only major crawler that executes a meaningful amount of JavaScript, and that Google can render JavaScript weeks after crawling. Serving full HTML earlier avoids that delay. Google's own documentation recommends Prerender for dynamic rendering on sites with large amounts of JavaScript. The gem is written in Ruby, released under the MIT licence, and was created in 2013.
Key features
- Crawler request interception
- The middleware checks each request and only routes crawler traffic to the Prerender service, leaving normal browser requests untouched.
- Whitelist url paths
- Whitelist a single url path or multiple url paths. The middleware compares the user agent and the path against the list.
- Blacklist url paths
- Blacklist a single url path or multiple url paths to keep those pages out of the prerender flow.
- before_render caching hook
- Method intended for caching. It runs before the render call and lets the application store or inspect what is about to be fetched.
- after_render caching hook
- Method intended for caching. It runs after the render call so the returned HTML can be stored for later requests.
- Redis caching support
- The README states the middleware is ready to be used with redis for caching rendered pages.
- Prerender token option
- Pass prerender_token in the middleware configuration to use a prerender.io account and your own token.
- Protocol override option
- Option to hard set the protocol that the Prerender service uses when accessing your server.
- Own Prerender service
- The README has a section on using your own Prerender service instead of the hosted one.
- Custom rack response builder
- build_rack_response_from_prerender is listed as a method for building the Rack response from the prerender result.
How it works
- Add gem 'prerender_rails' to the application's Gemfile and install it.
- Insert config.middleware.use Rack::Prerender into the production environment configuration file.
- Optionally pass prerender_token to the middleware if you have a prerender.io account.
- A crawler requests a page and the middleware decides whether that request should be prerendered.
- The middleware calls the external Prerender service, which renders the page and returns static HTML.
- The HTML is returned to the crawler in place of the JavaScript page.
- For local testing, run the Prerender server locally and use Puma or Unicorn instead of single threaded WEBrick.
Plans and pricing
The gem is released under the MIT licence at no cost, and a prerender.io account token is optional with no price stated in the material.
Integrations and platforms
Works with
- Rails
- Rack
- redis
- prerender.io
Available as
- Web
Repository facts
- Repositoryprerender/prerender_rails
- LanguageRuby
- Stars357
- Forks87
- LicenceMIT
- Created2013-09-26
- Last commit2026-10-09
- Open issues8
Services and details
Does SEO work itself
YesFree plan or free tools
YesAPI or MCP server
Yes
No information yet on keyword research, content optimization, writes content with AI, technical audits, rank tracking, backlinks and link building, local SEO, AI search visibility, free trial, WordPress plugin, browser extension, built for agencies. The website did not say; check with the vendor.
About the company
- Company prerender
- Website: github.com/prerender/prerender_rails
Listing compiled from public sources and the product's own website. Last updated 2026-11-12. Report a correction or request removal. Back to GitHub repos.