Header conditions¶
This page will show you steps to configure header based condition. These then can be used at multiple places such as rewrite/caching/blocking rules.
Typical use-case is, you would want to pass all requests from bots to https://prerender.io/.
Here, we can achieve it by identifying all Bot requests by value of user-agent request header.
Note: Header conditions will work only on request-headers.
For demo purpose, we will be using www.nviztest.com
domain as an example. Here, we will only be using googlebot
and bingbot
user-agent for simplicity.
Prerequisite¶
- You must have a domain configured on Nitrogen.
Steps¶
-
Click on
Settings
menu, and openHeader Conditions
tab.
-
Click on
Create
button.
You will now be taken to a screen to provide header details.-
Group Name
: Provide short name about the cookie condition you are creating. For now, putBots
here. Note: Please keep the name meaningful and relevant. -
Header Name
: Enter the request-header name. We will be puttinguser-agent
here -
Header value
: Put a regex expression here that will be matched against incoming request's user-agent header's value. For now, put.*(googlebot|bingbot).*
here Note: By default header value match is case-insensitive.
-
-
Click on
Save
button. The configured pattern will be showed inHeader conditions
list.
You can now use this condition at many places such as rewrite/caching/blocking rules.