Skip to content

bug: Host header incorrectly parsed as Uri #95

Closed

Description

@nielsenko

Host headers are not URIs.

The Host header has specific valid formats defined by RFC specifications. Here are the accepted formats:

Basic Formats

Hostname only

Hostname with port

  • Host: example.com:8080
  • Host: localhost:3000
  • Host: api.example.com:443

IPv4 address

  • Host: 192.168.1.1
  • Host: 192.168.1.1:8080

IPv6 address (must be enclosed in brackets)

  • Host: [2001:db8::1]
  • Host: [2001:db8::1]:8080
  • Host: [::1]:3000

Important Rules

  • Case insensitive: Domain names in the Host header are case-insensitive
    • Host: Example.COM # Same as example.com
  • No scheme: The Host header must NOT include the protocol scheme
  • No path/query/fragment: Only hostname and port are allowed
    • Host: example.com/path # INVALID
    • Host: example.com?query=1 # INVALID
    • Host: example.com#fragment # INVALID
  • Single value: Only one Host header is allowed per request
    • Host: site1.com
    • Host: site2.com # INVALID - multiple Host headers
  • Required in HTTP/1.1: Must be present in all HTTP/1.1 requests
  • The port number, when specified, must be a valid integer between 1-65535. If omitted, the default ports (80 for HTTP, 443 for HTTPS) are assumed.

Activity

  1. self-assigned this
    on Jun 11, 2025
  2. moved this from Backlog to Later 🥳 in Relic Roadmapon Aug 5, 2025
  3. moved this from Inbox 📫 to Planned 🔭 in Serverpod Frameworkson Aug 14, 2025
  4. added
    bug
    on Aug 28, 2025
  5. moved this from Planned 🔭 to Next Up 🎯 in Serverpod Frameworkson Sep 1, 2025
  6. moved this from Next Up 🎯 to In Progress 🔥 in Serverpod Frameworkson Sep 2, 2025
  7. moved this from In Progress 🔥 to Done 🚀 in Serverpod Frameworkson Sep 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bug

Type

No type

Projects

Relationships

None yet

Development

No branches or pull requests

Issue actions