Skip to content

host JSON field returns resolved IP instead of hostname #2332

Closed

Description

@ehsandeep

httpx version:

latest

Current Behavior:

Currently, the host field in JSON output (-j) returns the resolved IP address instead of the actual hostname:

$ echo example.com | httpx -j | jq '.host, .input'
"23.220.75.245"
"example.com"

Expected Behavior:

host should return example.com

Proposed Fix:

  • Change host to return the actual hostname (from URL)
  • Add new host_ip field for the resolved/dialed IP address

After fix:

{
  "host": "example.com",
  "host_ip": "23.220.75.245",
  "a": ["23.215.0.138", "23.220.75.232", ...],
  ...
}

This makes the output semantically correct while preserving the useful "which IP was actually connected to" information in the new host_ip field.

Activity

  1. self-assigned this
    on Dec 6, 2025
  2. added
    Type: Bug
    on Dec 6, 2025
  3. added theissue type on Dec 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Type: Bug

Type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions