Skip to content

Conversation

@ammar-agent
Copy link
Contributor

Problem

The test_host_header_security test was flaky because it relied on Cloudflare consistently blocking mismatched Host headers (error 1034), but Cloudflare's behavior varies across datacenters and has become inconsistent.

Solution

Replace the Cloudflare-based test with httpbin.org/headers which reliably echoes back received headers. This allows us to directly verify that httpjail corrects mismatched Host headers without depending on external service blocking behavior.

The new approach:

  1. ✅ Tests what we control: httpjail's Host header correction
  2. ✅ Uses reliable service: httpbin.org simply echoes headers
  3. ✅ Has clear assertions: directly checks Host header values
  4. ✅ No flakiness: doesn't rely on varying security policies

Testing

cargo test --profile fast --test weak_integration test_host_header_security

All tests pass reliably without depending on unpredictable external service behavior.

Related to #57

Replace flaky Cloudflare-based test with httpbin.org/headers which reliably
echoes back received headers. This allows us to directly verify that httpjail
corrects mismatched Host headers without depending on external service
blocking behavior (which was inconsistent across datacenters).

The new approach:
1. Tests what we control: httpjail's Host header correction
2. Uses reliable service: httpbin.org simply echoes headers
3. Has clear assertions: directly checks Host header values
4. No flakiness: doesn't rely on varying security policies

Fixes the test failure that occurred because Cloudflare stopped consistently
blocking mismatched Host headers (error 1034).
@ammario ammario merged commit 574ca02 into main Nov 3, 2025
5 of 6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants