Welcome! Log In Create A New Profile

Advanced

Re: $request_uri without args

agentzh
September 14, 2011 11:40AM
On Wed, Sep 14, 2011 at 10:30 PM, Richard Kearsley
<Richard.Kearsley@m247.com> wrote:
>
> I don't need args at backend - but I DO need the url still encoded
>

Use the following line of Lua to strip the query args part (if any)
from ngx.var.request (i.e., the nginx variable $request_uri):

local uri = string.gsub(ngx.var.request_uri, "?.*", "")

and then you can feed the resulting uri variable into your subrequest
call instead of ngx.var.request_uri:

local res = ngx.location.capture("/proxy" .. uri,
{ args =
{ country = ngx.var.geoip_country_code, host = ngx.var.host }
} )

Hope it works for you :)

Regards,
-agentzh

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

$request_uri without args

Richard Kearsley September 14, 2011 09:52AM

Re: $request_uri without args

agentzh September 14, 2011 10:16AM

RE: $request_uri without args

Richard Kearsley September 14, 2011 10:32AM

Re: $request_uri without args

agentzh September 14, 2011 11:40AM

RE: $request_uri without args

Richard Kearsley September 14, 2011 12:34PM

Re: $request_uri without args

agentzh September 14, 2011 08:24PM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 226
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