Welcome! Log In Create A New Profile

Advanced

RE: $request_uri without args

Richard Kearsley
September 14, 2011 10:32AM
Agentzh, I'm glad you replied :)
I am trying to find out why something is happening - a bug in nginx or lua module (currently finding it hard to reproduce)
I'm using:

location /proxy
{
proxy_pass http://backend;
}

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

if ngx.var.request_url contains args like this:

/something/blah.jpg?34567

It gives 404

But like this:

/something/blah.jps?anything=34567

Works and gets processed ok

I don't need args at backend - but I DO need the url still encoded

Backend when accessed directly with curl/wget with "/something/blah.jpg?34567" returns ok

Any ideas?

-----Original Message-----
From: nginx-bounces@nginx.org [mailto:nginx-bounces@nginx.org] On Behalf Of agentzh
Sent: 14 September 2011 15:14
To: nginx@nginx.org
Subject: Re: $request_uri without args

On Wed, Sep 14, 2011 at 9:50 PM, Richard Kearsley <Richard.Kearsley@m247.com> wrote:
> Hi
>
> Is it possible to access the $request_uri without the args at the end?
>
> I know I can use $uri - but this returns the url-decoded uri.
>
> I need the url-encoded (I.e. unchanged from original request) but with
> the args stripped
>

Why not strip $request_uri yourself? You can use "if" + pcre regex or more preferably, set_by_lua/rewrite_by_lua provided by ngx_lua, to process what in $request_uri :)

Regards,
-agentzh

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

_______________________________________________
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: 220
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