TypeError: Trailer name must be a valid HTTP Token
Created by: dino-brzika
Hello everyone,
One of the customers that is using app that i am working on reported that it is crashing every few days. From log file i can see that it first starts with repeating proxy error (every 10 - 30s) caught in on error event of proxy:
{ [Error: write ECONNABORTED] code: 'ECONNABORTED', errno: 'ECONNABORTED', syscall: 'write' }
Then after 10 minutes it crashed with following error:
5/15/2018 10:21:58 PM : _http_outgoing.js:359
==========================================
5/15/2018 10:21:58 PM : throw new TypeError(
==========================================
5/15/2018 10:21:58 PM : ^
==========================================
5/15/2018 10:21:58 PM : TypeError: Trailer name must be a valid HTTP Token ["cookie "]
==========================================
5/15/2018 10:21:58 PM : at ClientRequest.OutgoingMessage.setHeader (_http_outgoing.js:359:13)
==========================================
5/15/2018 10:21:58 PM : at new ClientRequest (_http_client.js:79:14)
==========================================
5/15/2018 10:21:58 PM : at Object.exports.request (http.js:31:10)
==========================================
5/15/2018 10:21:58 PM : at Array.stream (D:\blabla\bundle\programs\server\npm\node_modules\http-proxy\lib\http-proxy\passes\web-incoming.js:119:74)
==========================================
5/15/2018 10:21:58 PM : at ProxyServer.<anonymous> (D:\blabla\bundle\programs\server\npm\node_modules\http-proxy\lib\http-proxy\index.js:80:21)
==========================================
5/15/2018 10:21:58 PM : at Server.closure (D:\blabla\bundle\programs\server\npm\node_modules\http-proxy\lib\http-proxy\index.js:125:43)
==========================================
5/15/2018 10:21:58 PM : at emitTwo (events.js:87:13)
==========================================
5/15/2018 10:21:58 PM : at Server.emit (events.js:172:7)
==========================================
5/15/2018 10:21:58 PM : at HTTPParser.parserOnIncoming [as onIncoming] (_http_server.js:537:12)
==========================================
5/15/2018 10:21:58 PM : at HTTPParser.parserOnHeadersComplete (_http_common.js:97:23)
==========================================
I had similar case but can't remember if it was "Trailer" or "Header" name issue several months ago and found here that issue was fixed in 1.16.2 version by using Trim on header key and app was updated to use that version of http-proxy library. App is using 1.16.2 version of http-proxy and node is 4.8.0 or 4.8.7. Any help is appreciated. Thanks in advance.
Best regards, Dino