0.0
No release in over 3 years
Low commit activity in last 3 years
Rack middleware to server-side render your JavaScript apps by prerender.cloud
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 1.3
>= 0

Runtime

 Project Readme

prerendercloud-ruby

Rack middleware for pre-rendering JavaScript single page apps with Headless-Render-API.com (formerly named prerender.cloud from 2016 - 2022)

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']