:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.
Python ab-testingai-analyticsanalyticscdpdata-warehouseexperimentsfeature-flagsjavascriptproduct-analyticspythonreactsession-replaysurveystypescriptweb-analytics
fix(provisioning): forward the caller IP from the region proxy (#86833)
Rafael Audibertb40f138e96db
diff --git a/ee/api/agentic_provisioning/region_proxy.py b/ee/api/agentic_provisioning/region_proxy.pyindex 2fa283b5fb2a..13efa5a3aca6 100644--- a/ee/api/agentic_provisioning/region_proxy.py+++ b/ee/api/agentic_provisioning/region_proxy.py@@ -62,6 +62,7 @@ PROXY_HEADER_ALLOWLIST = frozenset("accept","authorization","user-agent",+ "x-forwarded-for",})diff --git a/ee/api/agentic_provisioning/test/test_region_proxy.py b/ee/api/agentic_provisioning/test/test_region_proxy.pyindex 710d20c0c812..71a744578b98 100644--- a/ee/api/agentic_provisioning/test/test_region_proxy.py+++ b/ee/api/agentic_provisioning/test/test_region_proxy.py@@ -157,7 +157,7 @@ class TestShouldProxyBearerLookup(BaseTest):class TestProxyHeaderAllowlist(BaseTest):@patch("ee.api.agentic_provisioning.region_proxy.requests")- def test_strips_cookies_and_forwarded_headers(self, mock_requests):+ def test_strips_cookies_and_carries_the_caller_address(self, mock_requests):mock_response = MagicMock()mock_response.status_code = 200mock_response.content = b'{"status": "ok"}'@@ -169,7 +169,7 @@ class TestProxyHeaderAllowlist(BaseTest):data={},format="json",HTTP_COOKIE="sessionid=secret123",- HTTP_X_FORWARDED_FOR="10.0.0.1",+ HTTP_X_FORWARDED_FOR="203.0.113.7, 10.0.0.1",HTTP_STRIPE_SIGNATURE="t=123,v1=abc",HTTP_AUTHORIZATION="Bearer pha_test",)@@ -182,8 +182,10 @@ class TestProxyHeaderAllowlist(BaseTest):header_keys_lower = {k.lower() for k in forwarded_headers}assert "cookie" not in header_keys_lower- assert "x-forwarded-for" not in header_keys_lowerassert "stripe-signature" not in header_keys_lower+ # Carried through, so the other region's per-IP limits key on the caller+ # rather than on this region's egress address.+ assert forwarded_headers["X-Forwarded-For"] == "203.0.113.7, 10.0.0.1"assert "authorization" in header_keys_lowerassert "host" in header_keys_lowerassert forwarded_headers["Host"] == "eu.posthog.com"