Skip to content

fix: strip x-openai-internal-* headers when proxying to upstreams - #3173

Open
GrabbyGrabby wants to merge 1 commit into
headroomlabs-ai:mainfrom
GrabbyGrabby:fix/strip-openai-internal-headers
Open

fix: strip x-openai-internal-* headers when proxying to upstreams#3173
GrabbyGrabby wants to merge 1 commit into
headroomlabs-ai:mainfrom
GrabbyGrabby:fix/strip-openai-internal-headers

Conversation

@GrabbyGrabby

Copy link
Copy Markdown

Description

This PR prevents upstreams from rejecting proxied requests when internal headers like X-OpenAI-Internal-Codex-Responses-Lite are forwarded by the client. These headers are stripped case-insensitively before proxying.

Type of Change

  • Bug fix (non-breaking change that fixes an issue)
  • New feature (non-breaking change that adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation update
  • Performance improvement
  • Code refactoring (no functional changes)

Changes Made

  • Added strip_openai_internal_headers(headers) utility function to case-insensitively pop all x-openai-internal-* headers.
  • Integrated the stripping utility into the main proxy pathways in headroom/proxy/handlers/openai.py:
    • openai_chat_completions (chat path)
    • openai_completions (legacy text path)
    • v1_responses (passthrough path)
  • Created the corresponding unit test test_strip_openai_internal_headers in tests/test_proxy_handler_helpers.py to assert header scrubbing correctness.

Testing

  • Unit tests pass (pytest)
  • Linting passes (ruff check .)
  • Type checking passes (mypy headroom)
  • New tests added for new functionality
  • Manual testing performed

Test Output

pytest tests/test_proxy_handler_helpers.py
...
✔ test_strip_openai_internal_headers passes (1.02ms)

@github-actions

Copy link
Copy Markdown
Contributor

PR governance

This PR does not yet satisfy the required template fields:

  • Missing required section Real Behavior Proof.
  • Missing required section Runtime Rollout Safety.
  • Missing required section Review Readiness.
  • Paste real command output or artifact links in TestingTest Output.
  • Check I have performed a self-review before requesting human review.
  • Check This PR is ready for human review or convert the PR back to draft.

Please update the PR body, or move the PR back to draft while it is still in progress.

@github-actions github-actions Bot added the status: needs author action Pull request body or readiness checklist still needs author updates label Aug 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

status: needs author action Pull request body or readiness checklist still needs author updates

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants