Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Host header is missing from the Headers section #61

Open
sashee opened this issue Jul 31, 2020 · 1 comment
Open

Host header is missing from the Headers section #61

sashee opened this issue Jul 31, 2020 · 1 comment
Labels
bug Confirmed bug or issue

Comments

@sashee
Copy link

sashee commented Jul 31, 2020

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.

@darklynx
Copy link
Owner

darklynx commented Aug 2, 2020

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 darklynx added the bug Confirmed bug or issue label Aug 2, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Confirmed bug or issue
Projects
None yet
Development

No branches or pull requests

2 participants