Documentation ¶
Overview ¶
Package prerender provides a Prerender.io handler implementation and a Negroni middleware.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Options ¶
type Options struct { PrerenderURL *url.URL Token string BlackList []regexp.Regexp WhiteList []regexp.Regexp UsingAppEngine bool }
Options provides you with the ability to specify a custom Prerender.io URL as well as a Prerender.io Token to include as an X-Prerender-Token header to the upstream server.
func NewOptions ¶
func NewOptions() *Options
NewOptions generates a default Options struct pointing to the Prerender.io service, obtaining a Token from the environment variable PRERENDER_TOKEN. No blacklist/whitelist is created.
func (*Options) NewPrerender ¶
NewPrerender generates a new Prerender instance.
type Prerender ¶
type Prerender struct { Options *Options // contains filtered or unexported fields }
Prerender exposes methods to validate and serve content from a Prerender.io upstream server.
func (*Prerender) PreRenderHandler ¶
func (p *Prerender) PreRenderHandler(rw http.ResponseWriter, or *http.Request)
PreRenderHandler is a net/http compatible handler that proxies a request to the configured Prerender.io URL. All upstream requests are made with an Accept-Encoding=gzip header. Responses are provided either uncompressed or gzip compressed based on the downstream requests Accept-Encoding header
func (*Prerender) ServeHTTP ¶
func (p *Prerender) ServeHTTP(rw http.ResponseWriter, r *http.Request, next http.HandlerFunc)
ServeHTTP allows Prerender to act as a Negroni middleware.