Skip to content

Add flag to include default ports (80/443) in output #2328

Closed

Description

@iKhaled6

Description:

When using httpx, ports 80 and 443 are omitted from the output by default. This becomes problematic when piping results to other tools (like nuclei, naabu, or custom scripts) that expect or benefit from explicit port notation, or when normalizing output for consistency in asset inventories.

Example current behavior:

https://example.com    (port 443 omitted)
http://example.com     (port 80 omitted)
https://example.com:8443  (non-standard port shown)

Solution

Add a flag such as -include-default-ports or -show-all-ports that forces httpx to always display the port in output, even for 80/443.

Expected behavior with flag:

https://example.com:443
http://example.com:80
https://example.com:8443

Considered alternatives

  • Parsing JSON output and reconstructing URLs with jq
  • Post-processing with sed to append ports

These workarounds add complexity and break simple piping workflows.

Additional context

This would improve consistency when integrating httpx into automation pipelines and asset management workflows where explicit port notation is required.

Activity

  1. added
    Type: Enhancement
    on Dec 4, 2025
  2. ehsandeep commented on Dec 6, 2025

    @ehsandeep
    Member

    @iKhaled6 fair usecase, we already have ldp option which does the same thing but for host header, we extended the same option to reflect the same in CLI output as well in #2331

       -ldp, -leave-default-ports  leave default http/https ports in host header (eg. http://host:80 - https://host:443
    
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: Enhancement

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions