Skip to content
This repository was archived by the owner on Feb 2, 2024. It is now read-only.

fix: adding Host header value validation on proxy #54

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

jkyberneees
Copy link
Contributor

@jkyberneees jkyberneees commented Oct 3, 2021

This PR fixes/add first level of validation to the Host header value. Without this check, the proxy would throw an internal error if the Host header is missing.

A Host header field must be sent in all HTTP/1.1 request messages. A 400 (Bad Request) status code may be sent to any HTTP/1.1 request message that lacks a Host header field or that contains more than one.

Checklist

@jkyberneees
Copy link
Contributor Author

cc @osvaldo2627

@@ -43,6 +44,15 @@ function fastProxy (opts = {}) {
const sourceHttp2 = req.httpVersionMajor === 2
let headers = { ...sourceHttp2 ? filterPseudoHeaders(req.headers) : req.headers }

if (!headers.host) {
Copy link
Member

@climba03003 climba03003 Oct 4, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we check the host if the protocol is http/2 here?

From the document it must be exist for http/1.1. How about http/2?

@Eomm
Copy link
Member

Eomm commented Oct 26, 2022

Any update on this?

@Fdawgs Fdawgs requested a review from climba03003 May 6, 2023 21:32
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants