Remove query parameter

Barry Abrahamson barry at automattic.com
Thu Jun 17 09:09:10 MSD 2010


On Jun 16, 2010, at 11:28 PM, Igor Sysoev wrote:

> On Wed, Jun 16, 2010 at 07:41:39PM +0000, Ole Laursen wrote:
> 
>> Hi!
>> 
>> Does anyone happen to have a snippet for removing a query parameter from the
>> query string?
>> 
>> I want to remove utm_source/gclid/... (added by Adwords and similar) from the
>> URL used on the server, changing for instance /shop/?gclid=blabla to /shop/, so
>> that nginx uses the cached version of /shop/ rather than generating a new page
>> via the proxy backend.
> 
> There is no way to remove a parameter, however, you can to define
> cache key without a query string at all or with predefined parameters only:
> 
>       proxy_cache_key   $proxy_host$uri;
> or
>       proxy_cache_key   $proxy_host$uri?$arg_one&$arg_two;

The ability to blacklist specific args from the cache key would be a nice feature :)

--
Barry Abrahamson | Systems Wrangler | Automattic
Blog: http://barry.wordpress.com






More information about the nginx mailing list