D
D
Dmitry2018-08-22 11:32:05
Nginx
Dmitry, 2018-08-22 11:32:05

Nginx: how to properly pass query_string to header?

Good afternoon,
there is a site, a request like "GET /parameter?some_arg=aaabbbxxx" arrives in it.
It is necessary for the following to happen, the request is cut to "GET /parameter" , and the value of the some_arg parameter is written to the header with the same name.
Did it like this:

location /parameter {
if ($arg_some_arg ~ (.*)$){
add_header some_arg $1;
rewrite ^(.*)$ $uri? permanent;
}
proxy_pass http://backend:
other proxy settings;
}

Does not work. I don't see the header on the backend. How to take the value of some_arg into a variable?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Danila Vershinin, 2018-08-22
@q2digger

proxy_set_header arg_some_arg $arg_some_arg;

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question