You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The proxy in our setup is failing with Parse Error: Invalid header value char, probably because the server (Azure, not surprisingly) sending garbage in headers. It's okay if the request cannot be proxied in this case, but no response is returned to the client, and any further requests are blocked as well.
Happens on both nodejs v12 and v14, both with option --insecure-http-parser and without.
If --insecure-http-parser is given, the process completely exits on crash.
If --insecure-http-parser is not given, only the proxy gets stuck, dev server continues to work.
Reproduction
Reproduction would need a server that sends garbage in response to be set up as a proxy target. One example was discussed here nodejs/http-parser#520 probably any Imperva WAF endpoint would work, randomly depending on the set-cookie header's value.
// vite.config.jsimportvuefrom'@vitejs/plugin-vue';importpathfrom'path';// https://vitejs.dev/config/constconfig={plugins: [vue()],resolve: {alias: {'@': path.resolve(__dirname,'/src'),},},server: {port: 3001,proxy: {'/api': {target: 'https://an-imperva-azure-awf-hosted-endpoint.com',// cannot provide this myselfws: true,changeOrigin: true,},},}};exportdefaultconfig;
and run;
npx --no-install vite # to start the server
and
curl -v http://localhost:3001/api/something
would cause the error, depending on the headers from upstream server being proxied.
System Info
nodejs v12, v14
Used Package Manager
npm
Logs
normal (without --insecure-http-parser);
npx --no-install vite "--host""0.0.0.0"
vite v2.5.1 dev server running at:
> Local: http://localhost:3001/
> Network: http://10.0.76.118:3001/
> Network: http://10.1.45.121:3001/
> Network: http://10.0.44.121:3001/
> Network: http://172.17.0.1:3001/
> Network: http://172.19.0.1:3001/
> Network: http://172.28.0.1:3001/
ready in 658ms.
6:18:56 AM [vite] http proxy error:
Error: Parse Error: Invalid header value char
at TLSSocket.socketOnData (_http_client.js:509:22)
at TLSSocket.emit (events.js:315:20)
at TLSSocket.EventEmitter.emit (domain.js:467:12)
at addChunk (internal/streams/readable.js:309:12)
at readableAddChunk (internal/streams/readable.js:284:9)
at TLSSocket.Readable.push (internal/streams/readable.js:223:10)
at TLSWrap.onStreamRead (internal/stream_base_commons.js:188:23
with --insecure-http-parser;
vite:time 450ms /node_modules/.vite/chunk-VYEQUVMN.js?v=9b29af36 +52ms
vite:load 57ms [fs] /node_modules/.vite/vue-router.js?v=9b29af36 +43ms
vite:transform 5ms /node_modules/.vite/vue-router.js?v=9b29af36 +34ms
vite:time 74ms /node_modules/.vite/vue-router.js?v=9b29af36 +23ms
_http_outgoing.js:552
throw new ERR_INVALID_CHAR('header content', name);
^
TypeError [ERR_INVALID_CHAR]: Invalid character in header content ["set-cookie"]
at ServerResponse.setHeader (_http_outgoing.js:561:3)
at setHeader (/home/user/dev/app/node_modules/vite/dist/node/chunks/dep-972722fa.js:63565:15)
at /home/user/dev/app/node_modules/vite/dist/node/chunks/dep-972722fa.js:63591:7
at Array.forEach (<anonymous>)
at Array.writeHeaders (/home/user/dev/app/node_modules/vite/dist/node/chunks/dep-972722fa.js:63586:35)
at ClientRequest.<anonymous> (/home/user/dev/app/node_modules/vite/dist/node/chunks/dep-972722fa.js:65320:22)
at ClientRequest.emit (events.js:315:20)
at ClientRequest.EventEmitter.emit (domain.js:467:12)
at HTTPParser.parserOnIncomingClient [as onIncoming] (_http_client.js:641:27)
at HTTPParser.parserOnHeadersComplete (_http_common.js:126:17) {
code: 'ERR_INVALID_CHAR'
}
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! app@0.0.0 dev: `npx --no-install --node-arg --insecure-http-parser vite "--host" "0.0.0.0" "-d"`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the app@0.0.0 dev script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /home/node/.nodecache/npm/_logs/2021-09-09T05_55_31_698Z-debug.log
Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
Make sure this is a Vite issue and not a framework-specific issue. For example, if it's a Vue SFC related bug, it should likely be reported to https://github.com/vuejs/vue-next instead.
Describe the bug
The proxy in our setup is failing with
Parse Error: Invalid header value char
, probably because the server (Azure, not surprisingly) sending garbage in headers. It's okay if the request cannot be proxied in this case, but no response is returned to the client, and any further requests are blocked as well.Happens on both nodejs v12 and v14, both with option
--insecure-http-parser
and without.If
--insecure-http-parser
is given, the process completely exits on crash.If
--insecure-http-parser
is not given, only the proxy gets stuck, dev server continues to work.Reproduction
Reproduction would need a server that sends garbage in response to be set up as a proxy target. One example was discussed here nodejs/http-parser#520 probably any Imperva WAF endpoint would work, randomly depending on the
set-cookie
header's value.and run;
npx --no-install vite # to start the server
and
would cause the error, depending on the headers from upstream server being proxied.
System Info
Used Package Manager
npm
Logs
normal (without
--insecure-http-parser
);with
--insecure-http-parser
;Validations
The text was updated successfully, but these errors were encountered: