A logistics API relied on an Idempotency-Key header to prevent duplicate shipment labels. A gateway header allowlist change silently dropped the header. When clients retried after a timeout, the backend saw a new operation each time and created duplicates.
What happened
A logistics company introduced a shipment-priority API used by warehouse terminals and carrier partners. The endpoint relied on a documented Idempotency-Key header to prevent duplicate shipment creation when clients retried after a timeout. A gateway configuration change was made to standardize and minimize forwarded request headers.
The gateway continued forwarding authorization and content type, but silently dropped Idempotency-Key. Requests that reached the backend directly behaved correctly. Requests routed through the public gateway did not. When a carrier client experienced an intermittent timeout and retried, the backend saw a new operation each time and created duplicate shipment labels.
The API returned successful responses for both requests. Monitoring showed no increase in server errors, and the duplicate records were initially blamed on the carrier integration. Investigation revealed that the gateway had a header allowlist that was never tested against the API’s required-header contract.
Root cause
Header tests exercised the service directly instead of traversing the deployed gateway path. An intermediary removed a behavior-critical request header.
The fix
The company updated its gateway policy and introduced end-to-end tests that send required headers through the same route used by external consumers. Tests now verify header preservation, normalization, casing-insensitive handling where applicable, and explicit errors when required headers are absent.
Testing gaps and preventive tests
Required-header checks, proxy pass-through tests, duplicate-request scenarios, and gateway configuration conformance tests are all needed. Testing must traverse the actual deployed gateway path, not bypass it.
Business impact
Duplicate labels, carrier confusion, reconciliation work, and avoidable shipping charges.
Lesson learned
Headers are part of the observable API contract, and an intermediary can break that contract without changing application code.