client real-port
Hi!
I need a real client PORT with proxy enabled for my dns-record.
I tried to specify to modify the X-Client-Port header with the value cf.edge.client_port - it did not help (everything works without a proxy).
Tell me, how can I get the real client port?
7 Replies
what do you mean it didn't work? you didn't see the header, you think it's wrong, your application failed, etc?
On the side of my web server, I see the cf port, and not the one from which I am trying to come. If you disable the proxy, everything works
Are you reading the header you set, or what do you mean "I see the cf port"? It's not like just adding that header would make nginx understand the actual client port is something else now.
Leo has a good question though, are you sure you need it and aren't confusing it for anything else? The client port is just a random port in the ephemeral range like 62272, it's not going to be any use to your web server in any case I can think of, not like you can use it since the connection isn't to you
No, I'm not confusing anything. That's right, on the side of my application I need to see the real port of the client in the logs (from the range), by analogy with the real IP address
So you're saying when you read the X-Client-Port on your application, you just see Cloudflare's port (should probably be just 443 in 99% of cases, or one of the alt ports like 8443/etc)?
If it's helpful to have for comparsion/understanding, I have
custom-edge_port
here under requestHeaders setup like https://debug.chaika.me/, in a simple modify request headers transform rule