A
A
Anton Piskunov2014-12-12 02:58:39
Nginx
Anton Piskunov, 2014-12-12 02:58:39

How to remove a piece of the path when rewrite in nginx?

For example, there is a typical redirect:
location /path/to/url {
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header Host $host;
proxy_pass http://127.0.0.1:8080;
}
How to remove /path/to/url for final gate? So that the URL coming to 127.0.0.1:8080 does not start with /path/to/url, but with /.
Thank you.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
P
Power, 2014-12-12
@antonydevanchi

Surprisingly, it's very simple: just add a slash to proxy_pass:
(see proxy_pass )

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question