A
A
Andrey Minisol2016-09-23 12:30:30
Nginx
Andrey Minisol, 2016-09-23 12:30:30

How to parse header in nginx?

Good day.
I hope you can tell me which way to dig.
There is a bunch of nginx + apache, which in turn is hidden behind another server that is responsible for balancing.
Nginx on the server works as a proxy, but the HTTP_X_FORWARDED_FOR header contains a chain of ip addresses (balancer and user),
i.e. header HTTP_X_FORWARDED_FOR=192.168.0.1, 192.168.10.1
where 192.168.0.1 is the user's real ip, 192.168.10.1 is the ip of the balancer
, the question is, is it possible to somehow parse the HTTP_X_FORWARDED_FOR header and put the first address in the header: REMOTE_ADDR?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Andrey Burov, 2016-09-23
@BuriK666

nginx.org/ru/docs/http/ngx_http_realip_module.html

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question