Proxy request to Prerender


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=

Is this possible?

Thank you.

You could try something like this: {
  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.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.