I have a client, which needs Varnish to be installed on his server. He is russian speaking and has an online shop with the following example URL, which needs to be excluded from cache (корзина is the cart page).


So, is there any special way of using non latin characters in VCL, as it seems not to work for me. I tried the following (actual code is longer than that and working for other web pages, this is just to show you an example):

if (
! req.url ~ "(...|корзина/|...)"
# or URLencoded:
! req.url ~ "(...|%D0%BA%D0%BE%D1%80%D0%B7%D0%B8%D0%BD%D0%B0/|...)"
{ unset req.http.cookie; }

Both seem to not work for me somehow - my rules are not triggered. So, how should I use non latin characters in VCL?


Non latin characters in an URL must be encoded AND lower case:

tr "[A-Z]" "[a-z]" < <(php -r 'echo( urlencode("корзина") . PHP_EOL );')

So this will work:

req.url ~ "(...|%d0%ba%d0%be%d1%80%d0%b7%d0%b8%d0%bd%d0%b0|...)" ...

This won't:

req.url ~ "(...|%D0%BA%D0%BE%D1%80%D0%B7%D0%B8%D0%BD%D0%B0/|...)" ...
req.url ~ "(...|корзина/|...)" ...

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.