Does reqwest add the host header on its own when doing a request? #2216
Unanswered
AlexanderProd
asked this question in
Q&A
Replies: 1 comment
-
Yes and no. It does automatically add the host header for HTTP/1 requests, if it the header is missing. If it's there, nothing is added. But, you might be sending HTTP/2 requests, and while the host header isn't illegal, some servers don't like it. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I'm doing a post request like this:
When I include the host header like this I get an 400 error saying that may request is invalid. When I omit the Host header the request works fine.
The host header which I set is the same as in the endpoint which I call.
So I'm wondering if reqwest adds the header on its own down the line and therefore there a two headers present which would cause the 400 error.
Beta Was this translation helpful? Give feedback.
All reactions