V
V
Vladimir Mukovoz2017-08-03 07:12:16
Nginx
Vladimir Mukovoz, 2017-08-03 07:12:16

How to remove one of the arguments in a request to nginx?

For example, a request comes to nginx
site.ru/?mvx=34234&rty=23423
Moreover, the values ​​of the arguments can change.
How can I remove the mvx argument with its value from the request and still keep the other arguments?
I understand that rewrite will help here, but something got stuck with writing a regular expression.
It is necessary that the site does not know at all that this argument took place, the argument is only for nginx.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
P
Pavel Serenko, 2017-08-04
@castomi

Try this, haven't tested it myself but should work.
And yes, I know that if is evil :)

if ($query_string ~ "^(.*)mvx=(.*)$") {
    rewrite ^(.*)$ $uri? permanent;
}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question