Remove query parameter

Igor Sysoev igor at sysoev.ru
Thu Jun 17 08:28:05 MSD 2010


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;


-- 
Igor Sysoev
http://sysoev.ru/en/



More information about the nginx mailing list