Skip to content

Host header is being set incorrectly, by appending port unnecessarily #222

@brian-mann

Description

@brian-mann

@bahmutov Related to #215.

This is actually a bug in the underlying request library we use to issue HTTP requests. I've opened an issue here: request/request#2372

request is appending the port to the Host header which causes zeit.co to return a 404 (like all reverse proxies likely will). That's because port should only be appended to the Host header when its not 80 or 443.

You can simulate exactly what request is doing under the hood via curl.

## this will return 404
curl -I https://todomvc-express.bahmutov.com:443/app.css --header 'Host: todomvc-express.bahmutov.com:443'
## this will return 200
curl -I https://todomvc-express.bahmutov.com:443/app.css --header 'Host: todomvc-express.bahmutov.com'

After splunking through request's code I see that if we were to parse out the url ourselves instead of providing as a string, it would work correctly. So we'll do that until they issue a fix.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions