Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

get-url-proxy

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

get-url-proxy

get-url-proxy will return the applicable proxy to use for a given URL based on NO_PROXY and PROT_PROXY environment variables

  • 1.1.2
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

node-get-url-proxy

get-url-proxy will return the applicable proxy to use for a given URL based on NO_PROXY and {PROTOCOL}_PROXY environment variables.

console.log(process.env.HTTP_PROXY) // "http://proxy:8080/"
console.log(process.env.NO_PROXY); // ".foo.com,192.168.1."

// requires protocol & domain
var getProxy = require('get-url-proxy');
getProxy('http://foo.com/'); // null
noProxy('https://www.google.com/'); // "http://proxy:8080/"

// the cached wrapper will cache the last 100 resources
var cachedProxy = require('get-url-proxy/cached');

// protocol only, without NO_PROXY check
var protocolProxy = require('get-url-proxy/protocol');
protocolProxy('https'): // "http://proxy:8080/"

Search Order

The following search order will be used, generally speaking...

  • NO_PROXY exclusion will return null
  • PROTOCOL_PROXY
  • protocol_proxy
  • ALL_PROXY
  • all_proxy
  • null will be returned with no match.

Web protocols

For web based protocols, additional/similar protocols will be searched as a fallback.

  • HTTP -> [HTTP, HTTPS]
  • HTTPS -> [HTTPS, HTTP]
  • WS -> [WS, WSS, HTTPS, HTTP]
  • WSS -> [WSS, WS, HTTPS, HTTP]
  • SFTP -> [SFTP, SSH]

All other protocols will only search for their own protocol specifically, falling back to ALL_PROXY


NOTE: You may want to use memoization around this module.

WARNING

If you are using a node version prior to Node 8, you should install url-parse as a dependency.

Keywords

FAQs

Package last updated on 17 Nov 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc