jitsu icon indicating copy to clipboard operation
jitsu copied to clipboard

feat(ingest): add configurable TRUSTED_IP_HEADERS for proxy support

Open VolanDeVovan opened this issue 1 month ago • 2 comments

When running Jitsu behind Cloudflare, the service couldn't get the real client IP because Cloudflare uses CF-Connecting-IP header instead of the standard X-Real-Ip or X-Forwarded-For.

This PR adds a TRUSTED_IP_HEADERS environment variable that lets you configure which headers to check for client IP, in priority order.

Why a configurable list instead of just adding Cloudflare support?

In real deployments, you might have mixed scenarios:

  • Frontend behind Cloudflare sending browser events
  • Backend services (e.g., Next.js server) sending server-side events through different proxies
  • Custom proxy setups with their own headers

A simple "enable Cloudflare" flag wouldn't work here. The configurable header list gives flexibility for any proxy setup.

VolanDeVovan avatar Nov 26 '25 19:11 VolanDeVovan

From the design stand-point, LGTM. @absorbb would you please take a look?

vklimontovich avatar Nov 26 '25 21:11 vklimontovich

@VolanDeVovan Just curious Cloudflare by default should add X-Forwarded-For header along with CF-Connecting-IP https://developers.cloudflare.com/fundamentals/reference/http-headers/#x-forwarded-for

Could you please make sure that there is no Managed Transform rule that removes X-Forwarded-For header?

absorbb avatar Nov 27 '25 06:11 absorbb