Cookie conditions¶
This page will show you steps to configure cookie based condition. These then can be used at multiple places such as rewrite/caching/blocking rules.
Typical use-case is, you would disable cache for pages when opened in preview mode.
Here, we can achieve it by disabling caching when we have Shopify's 'preview_theme' cookie is present.
Note: For demo purpose, we will be using www.nviztest.com
domain as an example.
Here, we will be using preview_theme
cookie. You can use any relevant cookie
Prerequisite¶
- You must have a domain configured on Nitrogen.
Steps¶
-
Click on
Settings
menu, and openCookie Conditions
tab.
-
Create condition by clicking on
Create
button.
You will now be taken to a screen to provide cookie-condition details.-
Group Name
: Provide short name about the cookie condition you are creating. For now, putShopify preview_theme cookie
here. Note: Please keep the name meaningful and relevant. -
Cookie Name
: Enter cookie name. We will be puttingpreview_theme
here Note: Cookie name is matched as regex. Therefore all the cookies with name containing preview_theme will match here. For absolute names you can use ^ and \$ in regex e.g. ^shopid$ -
Match if cookie is not present
: Switch this flag on if you only wish to match when given cookie is not present. We will keep it disabled for now
-
-
Click on
Save
button. The configured pattern will be showed inCookie Conditions
list.
You can now use this condition at many places such as rewrite/caching/blocking rules.