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
Unleash Proxy Docker image, and Unleash Proxy as a standalone Node.js app, to support configuring http/http proxies via environment variables.
Background
Unleash proxy docker image, and Unleash Proxy as a standalone Node.js app, do not seem to support http/http proxies (for instance a corporate proxy). So running them out of the box inside a corporate network that requires a proxy for egress traffic is not possible.
There is a discussion around this here but the suggested workarounds do not seem to work.
The workaround, is to create a new Node.js app, depend on unleash-proxy, and then start the app using the following, and then Dockerize it, etc.
import{createApp}=from'@unleash/proxy';import{URL}from'url';import{getAgent}from'@npmcli/agent';constagentDefaultOptions={keepAlive: true,keepAliveMsecs: 30*1000,timeout: 10*1000,};constapp=createApp({httpOptions: {// By using the getAgent function from npmcli/agent, the support // for PROXY, HTTP_PROXY, HTTPS_PROXY and NO_PROXY is unmasked// unleash-client-node masks this support by providing its own agentsagent: (url: URL)=>getAgent(url,{options: agentDefaultOptions}),},});app.listen(3000,()=>console.log(`Unleash Proxy listening on http://localhost:3000/proxy`),);
I understand this may require changes in the Unleash Node Client. Otherwise, if the changes I mentioned above look good to the maintainers, I will be happy to make a pull request.
Solution suggestions
Make use of getAgent from npm/cli to make use of the out of the box support for proxies provided by npm/cli.
The text was updated successfully, but these errors were encountered:
Thanks @kwasniew , I confirm version 1.4.0 is working for us. It supports HTTP_PROXY and HTTPS_PROXY. It however does not support NO_PROXY. For our use case it works, but I imagine for some it may not.
I will close this issue, but do you see any downside to the approach I posted in the OP? That is passing the defaultOptions to the getAgent function of @npmcli/agent (which supports all of these env vars)?
@naderghanbari I described my design decision of not using @npmcli/agent here: Unleash/unleash-client-node#638. It comes down to TS support. If we get feedback about NO_PROXY we'll consider adding it later. Glad to hear the current solution works for your team.
Describe the feature request
Unleash Proxy Docker image, and Unleash Proxy as a standalone Node.js app, to support configuring http/http proxies via environment variables.
Background
Unleash proxy docker image, and Unleash Proxy as a standalone Node.js app, do not seem to support http/http proxies (for instance a corporate proxy). So running them out of the box inside a corporate network that requires a proxy for egress traffic is not possible.
There is a discussion around this here but the suggested workarounds do not seem to work.
The workaround, is to create a new Node.js app, depend on
unleash-proxy
, and then start the app using the following, and then Dockerize it, etc.I understand this may require changes in the
Unleash Node Client
. Otherwise, if the changes I mentioned above look good to the maintainers, I will be happy to make a pull request.Solution suggestions
Make use of
getAgent
fromnpm/cli
to make use of the out of the box support for proxies provided bynpm/cli
.The text was updated successfully, but these errors were encountered: