hackney icon indicating copy to clipboard operation
hackney copied to clipboard

Incorrect Host header used on redirected requests

Open sykesm opened this issue 2 years ago • 2 comments

When a request is made to a server running on a non-standard port, the port should be included in the Host header. This is part of RFC-2616.

When follow_redirect is enabled and the client gets a 302 redirect, hackney's request to the new target includes a Host header for the new host but it does not include the port. When used with strict servers, this results in a bad request response.

sykesm avatar Oct 20 '21 12:10 sykesm

mmm are you sure of this? The rfc says

A "host" without any trailing port information implies the default port for the service requested

Was the port different from 80 or 443? I will write a test for it anyway.

benoitc avatar Mar 14 '22 18:03 benoitc

Was the port different from 80 or 443? I will write a test for it anyway.

Yes, that's what I meant by "non-standard port."

sykesm avatar Mar 14 '22 20:03 sykesm