I have an Angular.js website and I am trying to proxy requests to Prerender when the user agent indicates it is a bot.
User agent regex: /bot|googlebot|crawler|spider|robot|crawling/i
Should proxy request to Prerender: http://localhost:3000/render?url=https://www.example.com/about
example.com {
rewrite {
if_op or
if {>User-Agent} has bot
if {>User-Agent} has googlebot
if {>User-Agent} has crawler
if {>User-Agent} has spider
if {>User-Agent} has robot
if {>User-Agent} has crawling
to /render?url={scheme}://{host}{uri}
}
proxy /render localhost:3000
}
That’s assuming that the url query should be dynamic. If not, replace {scheme}://{host}{uri} with the exact static URL you want it to use for the url query.