grpc-node icon indicating copy to clipboard operation
grpc-node copied to clipboard

Support wildcard domains in no_grpc_proxy/no_proxy proxy configurations.

Open zamnuts opened this issue 5 years ago • 1 comments
trafficstars

PR #1243 introduced proxy support, and preemptively both the no_grpc_proxy and no_proxy configurations which dictate what hosts/domains should not be proxied. Currently, only strict equality is used to test if a host should not be proxied. See https://github.com/grpc/grpc-node/blob/%40grpc/grpc-js%400.7.0/packages/grpc-js/src/http_proxy.ts#L119

This is great for applications that require mixed proxy usage (requests both internal and external). However, within an organization having an abundance of internal sub-domains (e.g. foo.example.com, bar.example.com, etc), every single known sub-domain must be included in the no_grpc_proxy/no_proxy list.

Solution

Support conventional wildcard entries within no_grpc_proxy/no_proxy. There are two ways to obtain multi-level sub-domain matching, whereby both have the same effect:

  • *.example.com: use *, although less common
  • .example.com: just prefix the domain with a ., most common

In both of these cases, foo.example.com, bar.qux.example.com, and example.com would match.

Secondarily, using no_proxy='*' effectively disables any and all proxy configurations. This is seen in request (linked below).

Additional references

request: https://github.com/request/request/pull/1096 curl: https://github.com/curl/curl/issues/1208#issuecomment-272837735 GNU Emacs: https://www.gnu.org/software/emacs/manual/html_node/url/Proxies.html

zamnuts avatar Mar 08 '20 07:03 zamnuts

Code: https://github.com/grpc/grpc-node/blob/master/packages/grpc-js/src/http_proxy.ts#L152

Interesting implementation: https://github.com/request/request/blob/master/lib/getProxyFromURI.js#L19

ebuildy avatar Jun 20 '22 12:06 ebuildy