This is an old revision of the document!


If you use a custom integration with lscache where there's no crawler available, warming up using curl can often be an easy and very flexible method to warm up your cache.

You can use simple curl commands either via bash (or similar), or programming languages to make your own crawler that fits to your needs.

We recently came by a case where a client was trying to crawl a page with a specific cookie, the rewrite roles would look something like this

RewriteCond %{HTTP_USER_AGENT} "iPhone|iPod" [NC]
RewriteCond %{HTTP_COOKIE} cookie_test [NC]
RewriteRule .* - [E=Cache-Control:vary=is_mobile]

The client wanted to check simply if the user agent contained iPhone or iPod and if a specific cookie (in this case cookie_test was set.

The RewriteCond simply checks for whether cookie_test was present or not.

However, when warming up with curl it's important that the RFC6265 Section 5.2.2 is followed.

One would think that it's simply satisfying the RewriteCond by doing --cookie cookie_test in the curl command, however this is against RFC6265 so curl will simply ignore the cookie and not send it at all.

To send an empty cookie with curl, it's important to add the equal sign (==) as such:

curl --cookie cookie_test= -A "iPod" https://example.com/

Without the = the RewriteCond %{HTTP_COOKIE} cookie_test [NC] will get the result -1 (false) and thus not set the vary to is_mobile.

  • Admin
  • Last modified: 2019/10/25 17:31
  • by Lucas Rolff