- 
                Notifications
    
You must be signed in to change notification settings  - Fork 17
 
Open
Description
im using the following code:
const proxy = require('http2-proxy');
const finalhandler = require('finalhandler');
const defaultWebHandler = (err, req, res) => {
  if (err) {
    console.error('proxy error', err)
    finalhandler(req, res)(err)
  }
}
const server = require('http2').createServer((req, res) => {
  console.log(req.headers)
  console.log(req.url)
}).listen(8080)
server.on('request', (req, res) => {
  proxy.web(req, res, {
    hostname: 'localhost',
    port: 8081
  }, defaultWebHandler)
})
and getting the error:
proxy error Error: Parse Error: Expected HTTP/
at Socket.socketOnData (_http_client.js:509:22)
at Socket.emit (events.js:315:20)
at addChunk (internal/streams/readable.js:309:12)
at readableAddChunk (internal/streams/readable.js:284:9)
at Socket.Readable.push (internal/streams/readable.js:223:10)
at TCP.onStreamRead (internal/stream_base_commons.js:188:23) {
bytesParsed: 0,
code: 'HPE_INVALID_CONSTANT',
reason: 'Expected HTTP/',
rawPacket: <Buffer 00 00 18 04 00 00 00 00 00 00 04 00 40 00 00 00 05 00 40 00 00 00 06 00 00 20 00 fe 03 00 00 00 01 00 00 04 08 00 00 00 00 00 00 3f 00 01>,
statusCode: 502,
connectedSocket: true,
reusedSocket: false
}
Metadata
Metadata
Assignees
Labels
No labels