C
C
cat_crash2012-05-18 20:25:46
Nginx
cat_crash, 2012-05-18 20:25:46

NGINX request proxying with rewrite

Is it possible to proxy requests to UPSTREAM in NGINX by applying rules to the REWRITE request? For example, there is a request like:
get /one/two/three/four/image.png
You need to proxy it to upstrem in the form of GET /one?param1=two¶m2=three, etc.
Reading the documentation didn't help

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Alexey Akulovich, 2012-05-18
@cat_crash

nginx.org/ru/docs/http/ngx_http_proxy_module.html#proxy_pass
location /name/ {
rewrite /name/([^/]+) /users?name=$1 break;
proxy_pass 127.0.0.1;
}
Isn't it?

A
Albertum, 2012-05-18
@Albertum

Split the task into two: 1) rewrite 2) proxy, each of which is solved by a separate rule

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question