Skip to content

Host header overwritten in unsafe mode when using -target with raw requests #2296

Closed

Description

@ayanrajpoot10

httpx version:

latest (dev branch)

Current Behavior:

When using -rr (raw request) together with -target in unsafe mode, httpx overwrites the Host header from the raw request file with the target host. This causes the original Host header specified in the request file to be ignored.

Expected Behavior:

The Host header from the raw request file should be preserved, even when -target and -unsafe are used.

Steps To Reproduce:

  1. Create a raw request file raw.txt:
GET / HTTP/1.1
Host: example.com
  1. Run httpx with:
httpx -rr raw.txt -target test.com -unsafe -debug
  1. Observe that the Host header is changed to test.com instead of staying as example.com.

Activity

  1. added
    Type: Bug
    on Oct 22, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type: Bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions