request-baskets icon indicating copy to clipboard operation
request-baskets copied to clipboard

Host header is missing from the Headers section

Open sashee opened this issue 5 years ago • 1 comments

When I send a request with a different Host header then the request is logged successfully but the Host is missing.

curl -H "Host: example.com" https://rbaskets.in/3vgdn65

Shows:

image

Testing with webhooks.site the host header is listed:

image

This prevents debugging host-related issues.

sashee avatar Jul 31 '20 07:07 sashee

This is a result of Go-lang net/http library behavior, see https://golang.org/src/net/http/request.go#L159

// For incoming requests, the Host header is promoted to the // Request.Host field and removed from the Header map.

:(

On the other hand the Request.Host field does not contain a host header only instead it is defined as following: https://golang.org/src/net/http/request.go#L221

TL;DR: if Host-header is not defined, Request.Host will contain a host part of the URL the request was made to :(

In order to expose Host-header properly I need to find out how to either get an access to the raw HTTP-request, or how to figure out that Request.Host field contains the host header and not the part of URL

darklynx avatar Aug 02 '20 22:08 darklynx