Remove query parameter

xgdlm grangier at gmail.com
Thu Jun 17 09:57:15 MSD 2010


This can be done using perl

something like this to remove _dc=xxxx args

perl_set $stripargskey '
		sub {
			my $r = shift;
			my $uri = $r->uri;
			return $uri if !$r->args;
			$uri = $uri."?".$r->args;
			$uri =~ s/_dc=\d+&?//g;
			return $uri;
		}
	';

proxy_cache_key $host$stripargskey;

xav


Le 16 juin 2010 à 21:41, Ole Laursen a écrit :

> 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.
> 
> 
> Ole
> 
> 
> _______________________________________________
> nginx mailing list
> nginx at nginx.org
> http://nginx.org/mailman/listinfo/nginx




More information about the nginx mailing list