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 Headers #15

Closed
xfreakart opened this issue May 16, 2017 · 1 comment
Closed

Host Headers #15

xfreakart opened this issue May 16, 2017 · 1 comment

Comments

@xfreakart
Copy link

After some minutes of fight, I saw that if in a curl like:
(Purge for Varnish stuff)
curl -v -X PURGE -H "Host: www.xxxx.com" ....

from: *request.go
// For server requests Host specifies the host on which the
// URL is sought. Per RFC 2616, this is either the value of
// the "Host" header or the host name given in the URL itself.
// It may be of the form "host:port". For international domain
// names, Host may be in Punycode or Unicode form. Use
// golang.org/x/net/idna to convert it to either format if
// needed.
//
// For client requests Host optionally overrides the Host
// header to send. If empty, the Request.Write method uses
// the value of URL.Host. Host may contain an international
// domain name.

Bad -> req.Header.Set("Host", "www.xxxx.com")
Good -> req.Host = "www.xxxx.com"

At least in: go version go1.8.1 linux/amd64

@mholt
Copy link
Owner

mholt commented May 16, 2017

Ah, so we need to add a special case for the Host header to set it differently. Noted, thanks!

PR welcome. ;) Been a bit busy with a conference paper deadline this week.

@mholt mholt closed this as completed in ba743d7 Aug 10, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants