1

there is an api , e.g. http://example.com/v2/series/search?token=xxx&&limit=50&offset=0&databases=WORLD

one day some query parameter changed , e.g. databases ==> database, and cause the request is failed

response code:400 message:Filter('s) `databases` is(are) not supported.

so how to change query parameter name in Nginx location block?

I know how to append parameter by below way, but how to change parameter name?

location = /v2/series/search {
    set $args $args&foo=bar;
    proxy_pass xxx;
}

1 Answer 1

1

Try this regex:

if ($args ~ (^|.*&)databases=(.*)) {
    set $args $1database=$2;
}

Should replace the databases query argument name to database regardless of whether it is at the beginning, in the middle or at the end of the query string.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.