Skip to content
master
Switch branches/tags
Go to file
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
lib
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

README.md

image

prerendercloud-ruby

Rack middleware for server-side rendering (prerendering) JavaScript web pages/apps (single page apps or SPA) with https://www.prerender.cloud/

Rails Usage

Gemfile

gem 'prerendercloud'

config/environment/production.rb

config.middleware.use Rack::Prerendercloud
# either hard code your secret token:
# config.middleware.use Rack::Prerendercloud, prerender_token: 'YOUR_TOKEN'
# or set the PRERENDER_TOKEN environment variable

Bots only

We don't recommend this setting due to:

  1. potential cloaking penalties
  2. missing out on performance gains of prerendering all traffic

but it's here if you want it:

config.middleware.use Rack::Prerendercloud, bots_only: true

Blacklist

Prevent certain paths from being prerendered (e.g. JSON API endpoints)

Pass an array of Regexps or Strings.

config.middleware.use Rack::Prerender, blacklist: [/^\/api/, '/housing_prices.json']

Whitelist

Only allow certain paths to be prerendered

Pass an array of Regexps or Strings.

config.middleware.use Rack::Prerender, whitelist: [/^\/users/, '/ips-v4']

About

Ruby Rack middleware middleware for server-side rendering JavaScript-rendered pages with https://www.prerender.cloud

Resources

License

Releases

No releases published

Packages

No packages published