Fix parsing X-Forwarded-For header. - #296
Conversation
treefrogframework
commented
May 19, 2020
To keep the specification simple, I would like to omit the ParseForwardedForHeaderRecursively parameter. |
The ParseForwardedForHeaderRecursively parameter is needed, if you want to trust only proxies that connect directly to the treefrog server, e.g. when I'm in a local network I connect through a proxy server 192.168.1.10, and being outside this network I connect through a proxy server with a public IP like 213.25.134.23 and then I don't want to trust 192.168.1.10 anymore. This is an equivalent to the real_ip_recursive parameter of the nginx server: If you don't like the name of this parameter then you can change it.
The implementation doesn't expect 'unix:' in the header - see the code. See also nginx set_real_ip_from parameter - it accepts 'unix:' value: |
treefrogframework
commented
May 25, 2020
About the node identifier, does it meet the RFC7239? |
amiart
commented
May 26, 2020
The apache server doesn't have it, so it seems it's a nginx-specific solution. |
treefrogframework
commented
Jun 13, 2020
I think it can support the following two patterns: |
amiart
commented
Jun 13, 2020
So you want to always trust proxy for unix: socket ? |
amiart
commented
Jul 19, 2020
Changed the code, so now TrustedProxyServers parameter accepts only IP addresses or subnets and the UNIX domain socket proxy is always trusted. |
treefrogframework
commented
Jul 20, 2020
About unix domain, it's a specification in RFC? |
Sorry, but I don't have such knowledge. |
treefrogframework
commented
Jul 23, 2020
Unfortunately, this pull-request is not acceptable. |
amiart
commented
Jul 23, 2020
What's wrong with the patch ? |
Fixes parsing of the header, and it is now possible to trust Unix domain socket proxy and proxy servers in a subnet.
In nginx configuration (reverse proxy) add this line:
In Treefrog configuration add these lines:
Fixes#285