cc @sepbot
parcel index.html --https
.proxyrc
{
"/api": {
"target": "http://localhost:5000/",
"pathRewrite": {
"^/api": ""
}
}
}
Works
requesting https://localhost:1234/api:
console: (node:51528) UnsupportedWarning: Status message is not supported by HTTP/2 (RFC7540 8.1.2.4)
(Use `node --trace-warnings ...` to show where the warning was created)
console: TypeError [ERR_INVALID_HTTP_TOKEN]: Header name must be a valid HTTP token [":path"]
at ClientRequest.setHeader (_http_outgoing.js:538:3)
at new ClientRequest (_http_client.js:251:14)
at Object.request (http.js:50:10)
at Array.stream (node_modules/http-proxy/lib/http-proxy/passes/web-incoming.js:126:74)
at ProxyServer.<anonymous> (node_modules/http-proxy/lib/http-proxy/index.js:81:21)
at middleware (node_modules/http-proxy-middleware/lib/index.js:46:13)
at call (node_modules/connect/index.js:239:7)
at next (node_modules/connect/index.js:183:5)
at Function.handle (node_modules/connect/index.js:186:3)
at Http2SecureServer.app (node_modules/connect/index.js:51:37)
index.html
Hello!
| Software | Version(s) |
| ---------------- | ---------- |
| Parcel | 46e8ffa3e781fcbee71dfba2fe83b7c0857f4866
I have the same problem with 2.0.0-beta.1 but the offending header is :scheme. I did not find a mention of :scheme in either http-proxy, http-proxy-middleware or connect, which are used. Actually, there are no mentions of :scheme inside my node_modules which makes it harder to trace :cry:
The issue triggers with
{
"/api": {
"target": "http://localhost:5000/",
}
}
Independent of pathRewrite
Maybe we should just remove http2 again? ๐
This way we're at least more stable again
Is it possible for me to toggle it in .parcelrc and fix this right now, or does it require work in parcel?
@ranisalt only way to work around it currently is to use http instead of https, which always uses http1 as http2 requires ssl for browsers.
If everyone agrees it's probably better to simply undo this change I can open up a PR in a couple hours
@ranisalt have you tried the changeOrigin option on your .proxyrc file?
I don't know if this is related, but, I was having this issue when calling cloud functions and adding that option resolved the issue.
{
"/api": {
"target": "https://us-central1-app.cloudfunctions.net/apiEndpoint",
"changeOrigin": true,
"ignorePath": true,
"logLevel": "debug"
}
}
@ranisalt only way to work around it currently is to use http instead of https, which always uses http1 as http2 requires ssl for browsers.
Wait, but why SSL requires http2 then?
@zanona no, I have the same issue.
@ranisalt we just wanted to provide a faster dev experience when using https by using http2, we could remove it as I mentioned it if it isn't reliable which is way more important that performance.
https doesn't require http2 it's just what we ended up doing
I doubt for local development HTTP/2 would provide significant performance improvements, I already have sub-1ms response times. Is the dev server expected to serve over the network too?
@ranisalt it could, for example on environments like codesandbox it does.
It should definitely not be used as a production server though.
But as you mentioned it's probably not worth the effort as you have barely any latency on a devserver and services like codesandbox can proxy it into http/2 if they want.
I am running into this exact error with parcel version 2.0.0-beta.1 while trying to proxy requests via https to my remote api in aws. I am running the parcel dev server with the --https flag. Was http/2 re-enabled since this issue was closed?
@adamaho beta.1 was released before this was merged. You need nightly.389 or newer.
Wonderful. Thanks a lot!
Most helpful comment
@ranisalt it could, for example on environments like codesandbox it does.
It should definitely not be used as a production server though.
But as you mentioned it's probably not worth the effort as you have barely any latency on a devserver and services like codesandbox can proxy it into http/2 if they want.