node-http-proxy
node-http-proxy copied to clipboard
If-Modified-Since header causes parse error
trafficstars
The following command throws a "Parse Error: Expected HTTP/":
curl 'http://192.168.88.32:8203/' -H 'If-Modified-Since: Thu, 01 Jan 1970 00:00:00 GMT'
(Command taken from a Safari browser, removed all HTTP headers that do not contribute to the error)
The following command works:
curl 'http://192.168.88.32:8203/'
Full error message:
Error: Parse Error: Expected HTTP/
at Socket.socketOnData (_http_client.js:515:22)
at Socket.emit (events.js:400:28)
at addChunk (internal/streams/readable.js:293:12)
at readableAddChunk (internal/streams/readable.js:267:9)
at Socket.Readable.push (internal/streams/readable.js:206:10)
at TCP.onStreamRead (internal/stream_base_commons.js:188:23) {
bytesParsed: 107,
code: 'HPE_INVALID_CONSTANT',
reason: 'Expected HTTP/',
}
Source code:
var http = httpProxy = require('http-proxy');
httpProxy.createProxyServer({ target: 'http://192.168.88.100', auth: 'user:password' })
.listen(8203)
.on('error', function (err, req, res) {
console.error(err);
res.writeHead(500, {
'Content-Type': 'text/plain'
});
res.end('HTTP proxy error: ' + err);
});
Version:
"http-proxy": "^1.18.1"
@adams-family Hello, is this problem solved? I'm having the same problem.
@whyour Unfortunately I don't really know as I'm now using this library anymore... Judging based on that there was no response to my topic, probably it hasn't got resolved.