-
Notifications
You must be signed in to change notification settings - Fork 72
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use HTTP/2 to make requests from proxies #1375
base: canary
Are you sure you want to change the base?
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
❌ Changes requested. Reviewed everything up to 95177ff in 1 minute and 22 seconds
More details
- Looked at
174
lines of code in1
files - Skipped
0
files when reviewing. - Skipped posting
2
drafted comments based on config settings.
1. typescript/fiddle-proxy/server.js:98
- Draft comment:
Consider adding error handling forreq.pipe(proxyReq)
to manage cases where the request body cannot be piped correctly. - Reason this comment was not posted:
Comment looked like it was already resolved.
2. typescript/fiddle-proxy/server.js:110
- Draft comment:
Consider adding error handling forproxyReq.on('data', ...)
to manage cases where the response data is not received correctly. - Reason this comment was not posted:
Decided after close inspection that this draft comment was likely wrong and/or not actionable:
The code already has comprehensive error handling. The 'data' event in Node.js streams doesn't typically need explicit error handling because: 1) Stream errors are caught by the 'error' event handler 2) Write errors would be caught by the response stream's error handler 3) The try-catch block would catch any synchronous errors. Adding more error handling would be redundant.
I might be overlooking some edge cases in HTTP/2 streaming that could cause data corruption without triggering the error event. There could be specific HTTP/2 stream error states that need special handling.
The existing error handlers are sufficient - the HTTP/2 stream errors would be caught by the proxyReq.on('error') handler, and Node.js's stream implementation is robust enough to handle data streaming issues.
The comment should be deleted as it suggests adding unnecessary error handling when the code already has comprehensive error handling in place.
Workflow ID: wflow_TDGrM4RVpAuyQFiV
Want Ellipsis to fix these issues? Tag @ellipsis-dev
in a comment. You can customize Ellipsis with 👍 / 👎 feedback, review rules, user-specific overrides, quiet
mode, and more.
typescript/fiddle-proxy/server.js
Outdated
|
||
if (allowedHeaders) { | ||
// Override headers. | ||
for ([header, value] of Object.entries(allowedHeaders)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Destructuring in the for loop is incorrect. It should be for (const [header, value] of Object.entries(allowedHeaders)) {
. This issue is also present in other parts of the code where destructuring is used in a for loop.
} | ||
|
||
// Establish HTTP/2 connection | ||
const client = http2.connect(targetUrl.origin); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider adding error handling for http2.connect
to manage cases where the connection cannot be established.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 Looks good to me! Incremental review on 9d6c1e5 in 32 seconds
More details
- Looked at
12
lines of code in1
files - Skipped
0
files when reviewing. - Skipped posting
1
drafted comments based on config settings.
1. typescript/fiddle-proxy/server.js:107
- Draft comment:
Setting 'Access-Control-Allow-Origin' to '*' can lead to security vulnerabilities by allowing any domain to access the resources. Consider restricting this to specific domains. - Reason this comment was not posted:
Decided after close inspection that this draft comment was likely wrong and/or not actionable:
This is a proxy server specifically designed to handle cross-origin requests to API providers. The use of '*' for CORS is intentional here as it's meant to be accessible from any origin. The server has other security measures in place, like the API_KEY_INJECTION_ALLOWED whitelist, which is the real security boundary. The CORS setting is not the security vulnerability here.
The comment raises a valid general security concern about CORS. In many applications, unrestricted CORS can indeed be dangerous.
However, in this specific case, the unrestricted CORS is an intentional and necessary part of the proxy server's design. The security is handled through other mechanisms like the origin whitelist.
The comment should be deleted as it raises a concern that doesn't apply to this specific use case where unrestricted CORS is intentional and necessary.
Workflow ID: wflow_KUgYrnGzvhKWVXhS
You can customize Ellipsis with 👍 / 👎 feedback, review rules, user-specific overrides, quiet
mode, and more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 Looks good to me! Incremental review on 08b6cc6 in 25 seconds
More details
- Looked at
235
lines of code in1
files - Skipped
0
files when reviewing. - Skipped posting
4
drafted comments based on config settings.
1. typescript/vscode-ext/packages/vscode/src/extension.ts:263
- Draft comment:
Consider using a proper logging library instead ofconsole.error
for better error tracking and management. - Reason this comment was not posted:
Confidence changes required:50%
The code usesconsole.log
for error logging, which is not ideal for production environments. A proper logging mechanism should be used.
2. typescript/vscode-ext/packages/vscode/src/extension.ts:268
- Draft comment:
Consider using a proper logging library instead ofconsole.error
for better error tracking and management. - Reason this comment was not posted:
Confidence changes required:50%
The code usesconsole.log
for error logging, which is not ideal for production environments. A proper logging mechanism should be used.
3. typescript/vscode-ext/packages/vscode/src/extension.ts:198
- Draft comment:
Consider using a proper logging library instead ofconsole.error
for better error tracking and management. - Reason this comment was not posted:
Confidence changes required:50%
The code usesconsole.log
for error logging, which is not ideal for production environments. A proper logging mechanism should be used.
4. typescript/vscode-ext/packages/vscode/src/extension.ts:199
- Draft comment:
Consider using a proper logging library instead ofconsole.error
for better error tracking and management. - Reason this comment was not posted:
Confidence changes required:50%
The code usesconsole.log
for error logging, which is not ideal for production environments. A proper logging mechanism should be used.
Workflow ID: wflow_9v8suRqLFIMIrPsN
You can customize Ellipsis with 👍 / 👎 feedback, review rules, user-specific overrides, quiet
mode, and more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 Looks good to me! Incremental review on 20cf0fc in 24 seconds
More details
- Looked at
96
lines of code in2
files - Skipped
0
files when reviewing. - Skipped posting
0
drafted comments based on config settings.
Workflow ID: wflow_DB3wI7jDbe4b2Kpx
You can customize Ellipsis with 👍 / 👎 feedback, review rules, user-specific overrides, quiet
mode, and more.
Google AI requires ALPN negotiation otherwise it returns
HTTP 400
. See PR #1318.Promptfiddle uses a Node.js proxy server in order to inject API keys into the request. However, the proxy was written using Express.js and
http-proxy-middleware
, which does not support HTTP/2 and ALPN by default.This is a rewrite of the proxy using the Node.js
http2
module.VSCode extensions uses a local proxy running on Express as well, same change applies to that proxy.
Important
Rewrites proxy servers in
server.js
andextension.ts
to use HTTP/2 for ALPN support, replacinghttp-proxy-middleware
.server.js
to use Node.jshttp2
module instead ofhttp-proxy-middleware
.extension.ts
to usehttp2
for proxying requests, ensuring compatibility with ALPN requirements.host
andorigin
headers from upstream requests in bothserver.js
andextension.ts
.API_KEY_INJECTION_ALLOWED
.baml-original-url
header in bothserver.js
andextension.ts
.500 Internal Server Error
response on failure.This description was created by for 20cf0fc. It will automatically update as commits are pushed.