Skip to content

Duplicated "Content-Type" header on proxy requests #1777

@diegossilveira

Description

@diegossilveira

The endpoint behind a Hapi.js proxy is receiving duplicated "Content-Type" header on the following scenario:

a) settings.passThrough = true
b) the request to the proxy includes a "Content-Type" header

Looking at the code on proxy.js file, I found this:

//proxy.js, line: 54
if (settings.passThrough) {
   options.headers = Hoek.clone(req.headers);
   ...
}

followed by this:

// proxy.js, line: 76
var contentType = req.headers['content-type'];
if (contentType) {
   options.headers['Content-Type'] = contentType;
}

I think that, if the second section is really needed, it should consider the settings.passThrough option too.

Metadata

Metadata

Assignees

Labels

bugBug or defect

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions