Skip to content
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

Support global-agent for central proxy configuration #3423

Merged
merged 6 commits into from
Nov 1, 2024

Conversation

akoo24
Copy link
Contributor

@akoo24 akoo24 commented Oct 28, 2024

With central configuration of global agent via environment variables, the proxy agent is included in all node-fetch requests without any code changes and thus it is no longer necessary to implement the proxy URL in each ChatModel. Currently, the ProxyUrl is implemented in ChatOpenAI_ChatModels and as an example is still required in AzureChatOpenAI_ChatModels. The existing proxy mechanism would continue to work if required, because the global agent can be deactivated by a missing environment variable.

  • Added global-agent as central Global HTTP/HTTPS proxy configurable sing environment variable
  • Server-Bootstrap on index.js
    • import global-agent/bootstrap
  • added dep in package.json
    • global-agent: "^3.0.0

…using environment variable

**  https://www.npmjs.com/package/global-agent
* Server-Bootstrap on index.js
** import 'global-agent/bootstrap'
* added dep in package.json
** global-agent: "^3.0.0
@akoo24 akoo24 marked this pull request as ready for review October 28, 2024 16:15
@HenryHengZJ
Copy link
Contributor

thanks @akoo24 ! How do i test this though?

@akoo24
Copy link
Contributor Author

akoo24 commented Oct 29, 2024

Hi Henry,

in our case we have an on-premises Kubernetes installation behind a corporate proxy.

This means that for testing purposes, outgoing connections to OpenAi / AzureOpenAI should only be possible via a proxy. In order to redirect outgoing requests centrally via a proxy, the following environment variables must be set at startup (see https://www.npmjs.com/package/global-agent)

  • GLOBAL_AGENT_HTTP_PROXY: CorporateProxyUrl

  • GLOBAL_AGENT_HTTPS_PROXY: CorporateProxyUrl

  • GLOBAL_AGENT_NO_PROXY: Exception hosts to bypass proxy if needed

If the environment variables are not set, no centralized routing via proxy takes place,

Best Regards
Ali

Copy link
Contributor

@HenryHengZJ HenryHengZJ left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thank you @akoo24 !

@HenryHengZJ HenryHengZJ merged commit d9bf612 into FlowiseAI:main Nov 1, 2024
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants