Handling of Urlencoded string in URL in Varnish

Per Buer perbu at varnish-software.com
Mon Apr 7 11:25:35 CEST 2014


Hi Jason.

Docwilco from Fastly has written an URL encoder/decorder VMOD that you can
use. You could run it through it twice or patch it do uppcase/lowercase the
encoding.

https://www.varnish-cache.org/vmod/url-code

Varnish itself doesn't try to interpret the URL much.

Per.


On Mon, Apr 7, 2014 at 11:01 AM, Jason Woods <devel at jasonwoods.me.uk> wrote:

> Hi all,
>
> I apologise if this is the wrong place for a general question / request
> for advice about Varnish. If there's a better place, please do let me know!
>
> I have a URL (that I've modified) that has an url encoded sequence, e.g.
> /block/jason%E2%80%99s-first-blog
> That sequence is a fancy apostrophe. It must have snuck into the title
> through a copy and paste or something, but it brought up some caching issue
> with the encoding.
>
> We notice that when we printed the URL links in HTML, it was printed as
> above, %E2%80%99. But when some browsers appear to request the URL, it
> seems to lowercase the encoding to %e2%80%99. So we ended up with two
> instances of this page cached. Presumedly the browser decoded the URL and
> then re-encoded it for the request.
> This meant that when we modified the blog post we sent a PURGE for
> %E2%80%99 - but it only updated one instance of the cache, and there were
> many people seeing the old version. We ended up having to manually PURGE
> the other cache.
>
> Would I be right in saying that the following two URL are identical, and
> should have one instance of cache? I'm not sure if this is accounted for in
> RFC/ISO of anything. URLs are generally case-sensitive IIRC but is it true
> also for encodings?
> /block/jason%E2%80%99s-first-blog
> /block/jason%e2%80%99s-first-blog
>
> Is there a way for Varnish to decode the URL before hashing for the cache?
> Or is there a better approach?
> We are using varnish-3.0.3 revision 9e6a70f, which may be quite old, maybe
> this is fixed in a recent version?
>
> Thanks!
>
> Jason
>
>
> _______________________________________________
> varnish-misc mailing list
> varnish-misc at varnish-cache.org
> https://www.varnish-cache.org/lists/mailman/listinfo/varnish-misc
>



-- 
 <http://www.varnish-software.com/> *Per Buer*
CTO | Varnish Software
Phone: +47 958 39 117 | Skype: per.buer
We Make Websites Fly!

Winner of the Red Herring Top 100 Global Award 2013
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.varnish-cache.org/lists/pipermail/varnish-misc/attachments/20140407/c46e0c9f/attachment.html>


More information about the varnish-misc mailing list