Uploaded image for project: 'MongoDB Shell'
  1. MongoDB Shell
  2. MONGOSH-1827

Add proxy configuration support to mongosh

    • Type: Icon: Task Task
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 2.3.0
    • Affects Version/s: None
    • Component/s: None
    • None
    • 3
    • Iteration Gamma Rays, Iteration Hippocamp, Iteration Ionosphere
    • Needed
    • Hide

      mongosh adds support for explicit proxy configuration.

      No new command line flags are added, but mongosh takes environment variables into account for establishing connections now. In particular:

      • MONGODB_PROXY for connections to mongodb:// and mongodb+srv:// URLs (i.e. database clusters and similar endpoints)
      • HTTP_PROXY for connections to http:// URLs (this should almost never be relevant for mongosh users)
      • HTTPS_PROXY for connections to https:// URLs
      • ALL_PROXY to specify all of the above at the same time
      • NO_PROXY for a comma-separated list of hostnames that should be excluded from proxying

      The supported proxy types are Socks5 proxies, HTTP proxies (for HTTP connections only), CONNECT proxies, and PAC (https://en.wikipedia.org/wiki/Proxy_auto-config) URLs that resolve to these proxies.

      The proxy type is specified through the protocol of the URL specified in each environment variable. Some examples:

      # Proxy all outbound network connections through a Socks5 proxy located at example.com:1234 with the credentials included in the URL
      ALL_PROXY=socks5://username:password@example.com:1234
      
      # Proxy all MongoDB cluster connections through a CONNECT proxy at example.com:8080 with TLS enabled,
      # and all HTTPS connections through a CONNECT proxy at localhost:8080 without TLS 
      MONGODB_PROXY=https://example.com:8080
      HTTPS_PROXY=http://localhost:8080
      

      Currently, "HTTP connections" and "HTTPS connections" refer primarily to connections made as part of OIDC authentication. Some outbound connections, such as those used by In-Use Encryption KMS services, are not included.

      Show
      mongosh adds support for explicit proxy configuration. No new command line flags are added, but mongosh takes environment variables into account for establishing connections now. In particular: MONGODB_PROXY for connections to mongodb:// and mongodb+srv:// URLs (i.e. database clusters and similar endpoints) HTTP_PROXY for connections to http:// URLs (this should almost never be relevant for mongosh users) HTTPS_PROXY for connections to https:// URLs ALL_PROXY to specify all of the above at the same time NO_PROXY for a comma-separated list of hostnames that should be excluded from proxying The supported proxy types are Socks5 proxies, HTTP proxies (for HTTP connections only), CONNECT proxies, and PAC ( https://en.wikipedia.org/wiki/Proxy_auto-config ) URLs that resolve to these proxies. The proxy type is specified through the protocol of the URL specified in each environment variable. Some examples: # Proxy all outbound network connections through a Socks5 proxy located at example.com:1234 with the credentials included in the URL ALL_PROXY=socks5: //username:password@example.com:1234 # Proxy all MongoDB cluster connections through a CONNECT proxy at example.com:8080 with TLS enabled, # and all HTTPS connections through a CONNECT proxy at localhost:8080 without TLS MONGODB_PROXY=https: //example.com:8080 HTTPS_PROXY=http: //localhost:8080 Currently, "HTTP connections" and "HTTPS connections" refer primarily to connections made as part of OIDC authentication. Some outbound connections, such as those used by In-Use Encryption KMS services, are not included.
    • Developer Tools

          Assignee:
          anna.henningsen@mongodb.com Anna Henningsen
          Reporter:
          anna.henningsen@mongodb.com Anna Henningsen
          Votes:
          0 Vote for this issue
          Watchers:
          1 Start watching this issue

            Created:
            Updated:
            Resolved: