Ordering of query string parameters

Poul-Henning Kamp phk at phk.freebsd.dk
Thu May 5 07:54:21 CEST 2011


In message <BANLkTi=b12PEvHxgu2PBtTBTb8kVY8wsfg at mail.gmail.com>, Daniel Sell wr
ites:

>For example, these two URLs result in the same content:
>
>/index.php?a=1&b=2
>/index.php?b=2&a=1
>
>The URL generation is out of my control, and there are many possible
>parameters.
>
>As far as I can tell, Varnish will generate different hashes for these two
>URLs.  Is there anything I can do?

If you know the parameters are from a finite set, you can rewrite
vcl_hash to do them one at a time in a specific order:

	hash_data (the url)
	hash_data (param 'a')
	hash_data (param 'b')
	hash_data (param 'c')

A Vmod which sorts the params alphabetically might be a good idea if
this is a general problem

-- 
Poul-Henning Kamp       | UNIX since Zilog Zeus 3.20
phk at FreeBSD.ORG         | TCP/IP since RFC 956
FreeBSD committer       | BSD since 4.3-tahoe    
Never attribute to malice what can adequately be explained by incompetence.




More information about the varnish-misc mailing list