PredixDev / predix-webapp-starter

A web application starter kit built on Polymer, Web Components, NodeJS and Predix UI Components
https://predix-webapp-starter.run.aws-usw02-pr.ice.predix.io
Other
61 stars 75 forks source link

Use NO_PROXY environment variable (if set) #20

Open garbiras opened 6 years ago

garbiras commented 6 years ago

proxy-from-env npm module determines if a URL should be proxied by using the standard proxy environment variables (http_proxy, no_proxy etc.). NO_PROXY tokens are supported, including wildcard expressions (i.e. .ge.com)

KevinVecchione commented 6 years ago

I like the idea of smarter proxy handling. Would it make sense to completely replace 'corporateProxyAgent' with the retval from getProxyForUrl()?

gstroup commented 6 years ago

Yes, this looks good. I'll test this out, and try to get it merged in soon. Thanks for the contribution!

gstroup commented 6 years ago

I tested this out and hit a problem. I'm running locally behind a corporate firewall, with real services. My browser makes a request to localhost, which then proxies the request to the back end service. When I put in your change, I get an error. Since my no_proxy env var includes localhost, no proxy agent is added to the request. But I actually do need the proxy agent in this case.