1

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).

www.example.com/корзина/

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?

1 Answer 1

0

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 ~ "(...|корзина/|...)" ...

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .