Merging headers

We have 2 x-forwarded-for headers in our requests. We’d like to merge the values of each so the end result is a single x-forwarded-for header presented to our nodes. Or worse case we just remove one of them, but how do we choose which one to remove as they have the exact same name but different value. Is there a how-to on how to do this? Cheers, G.

I’m not sure why you would have 2, do you have an interal proxy as well as using Cloudflare? Normal behaviour should be for a second proxy to append data to the existing header, not add another one.

Assuming it is due an additional proxy, there’s nothing you can really do using Cloudflare since the second one is being added after the request has passed through Cloudflare.

If it’s not this, can you post some example full headers of the request to see what’s actually happening?

1 Like

I have read through the docs and realized Cloudflare always appends the IP to the existing x-forwarded-for so the problem is within our HAProxy. It’s HAProxy with does not do the merging and thus adds an additional x-forwaded-for header.

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.