-
Notifications
You must be signed in to change notification settings - Fork 49.8k
fix the problem that axios don't use the http proxy #21199 #21649
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
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -268,6 +268,16 @@ export async function invokeAxios( | |
| axiosConfig: AxiosRequestConfig, | ||
| authOptions: IRequestOptions['auth'] = {}, | ||
| ) { | ||
| // axios not apply the http.globalAgent, need set it manually | ||
| const url = process.env.HTTP_PROXY ?? process.env.HTTPS_PROXY ?? process.env.ALL_PROXY; | ||
| if (url) { | ||
| const parsedUrl = new URL(url); | ||
| axiosConfig.proxy = { | ||
| host: parsedUrl.hostname, | ||
| port: parseInt(parsedUrl.port) || (parsedUrl.protocol === 'https:' ? 443 : 80), | ||
| protocol: parsedUrl.protocol.replace(':', ''), | ||
| }; | ||
| } | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Bug: Proxy Architecture: Conflicting Configuration LogicSetting |
||
| try { | ||
| return await axios(axiosConfig); | ||
| } catch (error) { | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.
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.
The manual proxy implementation is incomplete and introduces a regression by ignoring the
NO_PROXYenvironment variable, which is handled by the existing proxy infrastructure. This change forces all requests through the proxy, breaking configurations for internal services.Prompt for AI agents