Differences

This shows you the differences between two versions of the page.

Link to this comparison view

litespeed_wiki:cache:curl-warmup [2019/10/25 17:31]
Lucas Rolff created curl-warmup page
litespeed_wiki:cache:curl-warmup [2019/10/25 19:10] (current)
Lisa Clarke Copyediting
Line 1: Line 1:
-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.+====== Custom Cache Crawler with Curl ====== 
 +If you use a custom integration with LSCache ​where there'​s no crawler available, 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.+Simple ​curl commands, executed ​either via bash (or similar), or programming languages, allow you to make your own crawler that fits your unique ​needs.
  
-==== Sending a specific cookie ​====+===== Example: ​Sending a Specific Cookie =====
  
 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 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
Line 11: Line 12:
   RewriteRule .* - [E=Cache-Control:​vary=is_mobile]   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 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. The ''​RewriteCond''​ simply checks for whether ''​cookie_test''​ was present or not.
  
-However, when warming up with curl it's important ​that the [[https://​tools.ietf.org/​html/​rfc6265#​section-5.2|RFC6265 Section 5.2.2]] ​is followed.+However, when warming up with curl it's important ​to follow ​the [[https://​tools.ietf.org/​html/​rfc6265#​section-5.2|RFC6265 Section 5.2.2]].
  
-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.+One would think that it'​s ​simple to satisfy ​the RewriteCond by doing ''​--cookie cookie_test''​ in the curl command, however this is against RFC6265so 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:+To send an empty cookie with curl, it's important to add the equal sign (''​=''​), like so:
  
   curl --cookie cookie_test= -A "​iPod"​ https://​example.com/​   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''​.+Without 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 19:10
  • by Lisa Clarke