Getting rid of args out of $request_uri

Discussion in 'Nginx' started by chilly_bang, Aug 8, 2017.

  1. #2
    hi
    i have a construction like

    location ~* {
    if ($args ~ *) {
    add_header Link "<$scheme://$http_host$request_uri>; rel=\"canonical\"";
    }
    }

    But i need to filter out args from $request_uri - the goal is to add non-parameter url as canonical to parameterized url. I can't use $uri - it makes url encoded, but i need original url.
    How can i bring this method of getting rid of args:

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

    together with my construction?
    thanks in advance!
     
    chilly_bang, Aug 8, 2017 IP