Skip to content

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

  1. You must have a domain configured on Nitrogen.

Steps

  1. Click on Settings menu, and open Cookie Conditions tab.
    Step

  2. Create condition by clicking on Create button.
    You will now be taken to a screen to provide cookie-condition details.

    1. Group Name: Provide short name about the cookie condition you are creating.
      For now, put Shopify preview_theme cookie here. Note: Please keep the name meaningful and relevant.

    2. Cookie Name: Enter cookie name.
      We will be putting preview_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$

    3. 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
      Step

  3. Click on Save button. The configured pattern will be showed in Cookie Conditions list.

You can now use this condition at many places such as rewrite/caching/blocking rules.

Notes