Re: Get rid of args from $request_uri

2017-08-08 Thread Lucas Rolff
I use the set_misc module from openresty and do something like:

if ($request_uri ~ "([^/?]*)(?:\?|$)") {
  set $double_encoded_filename $1;
}
set_unescape_uri $encoded_uri $double_encoded_uri;

Can probably be improved, but I can use $encoded_uri and get the reslt you’re 
looking for c0nw0nk.



From: nginx <nginx-boun...@nginx.org> on behalf of Zhang Chao 
<zchao1...@gmail.com>
Reply-To: "nginx@nginx.org" <nginx@nginx.org>
Date: Tuesday, 8 August 2017 at 16.07
To: "nginx@nginx.org" <nginx@nginx.org>
Subject: Re: Get rid of args from $request_uri





On 8 August 2017 at 22:02:32, chilly_bang 
(nginx-fo...@forum.nginx.org<mailto:nginx-fo...@forum.nginx.org>) wrote:
c0nw0nk Wrote:
---
> why don't you use
>
> $uri

Is it not so, that $uri will output an encoded url?

$uri is always the one decode once time and merge the slash(if you enable it).
___
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx

Re: Get rid of args from $request_uri

2017-08-08 Thread Zhang Chao
On 8 August 2017 at 22:02:32, chilly_bang (nginx-fo...@forum.nginx.org)
wrote:

c0nw0nk Wrote:
---
> why don't you use
>
> $uri

Is it not so, that $uri will output an encoded url?


$uri is always the one decode once time and merge the slash(if you enable
it).
___
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx

Re: Get rid of args from $request_uri

2017-08-08 Thread chilly_bang
c0nw0nk Wrote:
---
> why don't you use
> 
> $uri

Is it not so, that $uri will output an encoded url?

Posted at Nginx Forum: 
https://forum.nginx.org/read.php?2,275930,275937#msg-275937

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


Re: Get rid of args from $request_uri

2017-08-08 Thread c0nw0nk
why don't you use

$uri $is_args $args

This will build the URL like.

index.php ? arguement=value=morevalue


$request_uri will always output the full URL. Not individual segments of
it.

If you want the first part of the url only just use $uri on its own.

http://nginx.org/en/docs/http/ngx_http_core_module.html#var_uri

Posted at Nginx Forum: 
https://forum.nginx.org/read.php?2,275930,275936#msg-275936

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


Get rid of args from $request_uri

2017-08-08 Thread chilly_bang
Hi

I want to build a construction like

location ~* {
if ($args ~ *)  {
add_header Link "<$scheme://$http_host$request_uri>; rel=\"canonical\"";
}
}
but need to get rid of argues from $request_uri. The goal is from any url
with parameters to point with canonical auf non-parameter url counterpart.
I've realized a method to get rid of argues from $request_uri, like this:

map $request_uri $request_uri_path {
  "~^(?P[^?]*)(\?.*)?$"  $path;
}

I Need an advice - how are both snippets to put together?

Posted at Nginx Forum: 
https://forum.nginx.org/read.php?2,275930,275930#msg-275930

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