Welcome! Log In Create A New Profile

Advanced

Re: trouble changing uri to query string

Francis Daly
September 24, 2014 08:52AM
On Sun, Sep 21, 2014 at 04:40:00PM +0300, Roland RoLaNd wrote:

Hi there,

> Using map is cool idea, though i have around 2000 possible imageId and size and more than 9 million user id.. they're always imageIDs are prone to change, wouldn't that mean i have to add them manually every time ?

map can use regex.

However, map can only use a single variable, so I think you would need
two maps (or perhaps a "set" within an "if") in order to save the request
uri without the user part.

For example:

map $uri $the_bit_before_user {
~(?P<m>.*)&user=[0-9]+& $m;
default $uri;
}

map $uri $the_bit_after_user {
~&user=[0-9]+(?P<m>&.*) $m;
default "";
}

followed by a later

set $request_without_user $the_bit_before_user$the_bit_after_user;

could give you a variable that might be useful to use as part of your
cache_key.

> On another note, let's say i mapped all wanted cache keys, how can i force the incoming requests to match with that key ? as i would be stuck with the same dilemma as now, since the uri as it's missing the "?" isn't treating the arguments as query string but part of the uri itself...

There are no arguments. There is no query string. There is only the uri
(the location, in this case).

Can you describe what you want to happen when a client makes a request
of nginx?

I imagine it is something like "if nginx has the appropriate response
in cache send it; otherwise do something to populate the cache and send
the response". But I do not know what you think should populate the
cache in the first place.

f
--
Francis Daly francis@daoine.org

_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Subject Author Posted

trouble changing uri to query string

dnalor September 15, 2014 07:58AM

Re: trouble changing uri to query string

Francis Daly September 17, 2014 03:18AM

RE: trouble changing uri to query string

dnalor September 21, 2014 09:42AM

Re: trouble changing uri to query string

Francis Daly September 24, 2014 08:52AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 185
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready