Is any special handling (e.g. the addition of
        :class:`ReverseProxiedMiddleware`) necessary for thie config?
972606
def necessary(self) -> bool:
        
        return any([
            self.trusted_proxy_headers,
            self.http_host,
            self.remote_addr,
            self.script_name,
            self.server_name,
            self.server_port,
            self.url_scheme,
            self.rewrite_path_info,
        ])
1311016
function proxy() {
  const defaultProxy = {
    changeOrigin: true,
    ws: true,
    logLevel: 'info',
    xfwd: true,
    logProvider() {
      return {
        log(...args) {
          Logger.log(proxyLogRewrite(args));
        },
        debug(...args) {
          Logger.debug(proxyLogRewrite(args));
        },
        info(...args) {
          Logger.info(proxyLogRewrite(args));
        },
        warn(...args) {
          Logger.warn(proxyLogRewrite(args));
        },
        error(...args) {
          Logger.error(proxyLogRewrite(args));
        }
      };
    }
  };

  const { proxies } = settings.configuration;

  if (!proxies) {
    return null;
  }

  const config = [];

  // Iterate through each proxy configuration
  proxies.forEach(proxyConfiguration => {
    // Merge in defaults including custom Logger and custom request/response function
    const proxyConfig = merge({}, defaultProxy, proxyConfiguration, {
      onProxyReq: (proxyReq, req) => {
        onRequest(proxyConfiguration, proxyReq, req);
        if (typeof proxyConfiguration.onProxyReq === 'function') {
          proxyConfiguration.onProxyReq(proxyReq, req);
        }
      },

      onProxyRes: (proxyRes, req, res) => {
        onResponse(proxyConfiguration, proxyRes, req, res);
        if (typeof proxyConfiguration.onProxyRes === 'function') {
          proxyConfiguration.onProxyRes(proxyRes, req, res);
        }
      },

      onError: (err, req, res) => {
        onProxyError(proxyConfiguration, err, req, res);
        if (typeof proxyConfiguration.onError === 'function') {
          proxyConfiguration.onError(err, req, res);
        }
      }
    });

    const proxyContext = Array.isArray(proxyConfig.context) ? proxyConfig.context[0] : proxyConfig.context;

    // Only create proxy if enabled
    if (proxyConfig.enabled) {
      config.push(proxyConfig);
    } else {
      Logger.info(
        `Proxy with context: ${chalk.dim(proxyContext)} and target: ${chalk.dim(proxyConfig.target)} is ${chalk.magenta(
          'DISABLED'
        )}`
      );
    }
  });

  // return null if the array is 0 to make the checks easier upstream
  return config.length === 0 ? null : config;
}
554576
public function ensureProductionSettings() : void
    {
        $queryCacheImpl = $this->getQueryCacheImpl();

        if (! $queryCacheImpl) {
            throw QueryCacheNotConfigured::create();
        }

        if ($queryCacheImpl instanceof ArrayCache) {
            throw QueryCacheUsesNonPersistentCache::fromDriver($queryCacheImpl);
        }

        $metadataCacheImpl = $this->getMetadataCacheImpl();

        if (! $metadataCacheImpl) {
            throw MetadataCacheNotConfigured::create();
        }

        if ($metadataCacheImpl instanceof ArrayCache) {
            throw MetadataCacheUsesNonPersistentCache::fromDriver($metadataCacheImpl);
        }

        if ($this->getProxyManagerConfiguration()->getGeneratorStrategy() instanceof EvaluatingGeneratorStrategy) {
            throw ProxyClassesAlwaysRegenerating::create();
        }
    }
345593
public static void disableProxy() {
        System.clearProperty("http.proxyHost");
        System.clearProperty("http.proxyPort");
        System.clearProperty("http.proxyUserName");
        System.clearProperty("http.proxyUser");
        System.clearProperty("http.proxyPassword");
        System.clearProperty("https.proxyHost");
        System.clearProperty("https.proxyPort");
        System.clearProperty("https.proxyUserName");
        System.clearProperty("https.proxyUser");
        System.clearProperty("https.proxyPassword");

        _url = null;
        _port = null;
        _user = null;
        _pwd = null;
        hasProxy = false;
    }
243809
function ProxyHost ( options ) {
	// prepare
	var name;

	// connection with server
	this.active = false;

	/**
	 * proxy instance configuration
	 * @namespace
	 */
	this.config = {
		/** proxy server address */
		host : '127.0.0.1',

		/** proxy server websocket port */
		port : 8900,

		/** session name */
		name : 'anonymous',

		/** automatically try to restore connection on disconnect */
		reconnect : true,

		/** time between connection attempts (5s) */
		reconnectInterval : 5000
	};

	/**
	 * @type {WebSocket}
	 */
	this.socket = null;

	// validate and iterate input
	if ( options && typeof options === 'object' ) {
		for ( name in options ) {
			// rewrite defaults
			if ( options.hasOwnProperty(name) ) { this.config[name] = options[name]; }
		}
	}

	// try to establish connection
	this.connect();
}
659804
function finalize(base, path, patches, inversePatches) {
      if (isProxy(base)) {
          var state = base[PROXY_STATE];
          if (state.modified === true) {
              if (state.finalized === true) return state.copy;
              state.finalized = true;
              var result = finalizeObject(useProxies ? state.copy : state.copy = shallowCopy(base), state, path, patches, inversePatches);
              generatePatches(state, path, patches, inversePatches, state.base, result);
              return result;
          } else {
              return state.base;
          }
      }
      finalizeNonProxiedObject(base);
      return base;
  }
284913
def supports_proxies(*proxy_types):
    '''
    
    '''
    def _supports_proxies(fn):
        @wraps(fn)
        def __supports_proxies(*args, **kwargs):
            proxy_type = get_proxy_type()
            if proxy_type not in proxy_types:
                raise CommandExecutionError(
                    '\'{0}\' proxy is not supported by function {1}'
                    ''.format(proxy_type, fn.__name__))
            return fn(*args, **salt.utils.args.clean_kwargs(**kwargs))
        return __supports_proxies
    return _supports_proxies
291789
function enrouteHotReloadProxy(req, res, next) {
                                return reloadProxy({
                                    basePath: opts.basePath,
                                    method: method,
                                    req: req,
                                    res: res,
                                    routeName: routeName,
                                    sourceFile: sourceFile,
                                    excludePath: opts.excludePath
                                }, next);
                            }
1007136
function getProxyMiddleware(context, uri) {
  const pathRewrite = {};
  pathRewrite[`^${context}`] = url.parse(uri).pathname;

  return proxy({
    target: getHost(uri),
    changeOrigin: true,
    logLevel: 'warn',
    pathRewrite: pathRewrite,
  });
}
850821
def set_proxy(self, proxy_server, proxy_port, proxy_username,
                  proxy_password):
        
        if proxy_server and proxy_port:
            if proxy_username and proxy_password:
                self.proxy = {
                    "http": "http://{}:{}@{}:{}".format(proxy_username,
                                                        proxy_password,
                                                        proxy_server,
                                                        proxy_port),
                    "https": "https://{}:{}@{}:{}".format(proxy_username,
                                                          proxy_password,
                                                          proxy_server,
                                                          proxy_port),
                }
            else:
                self.proxy = {
                    "http": "http://{}:{}".format(proxy_server, proxy_port),
                    "https": "https://{}:{}".format(proxy_server, proxy_port),
                }
776973
def _make_serverproxy_handler(name, command, environment, timeout, absolute_url, port):
    
    # FIXME: Set 'name' properly
    class _Proxy(SuperviseAndProxyHandler):
        def __init__(self, *args, **kwargs):
            super().__init__(*args, **kwargs)
            self.name = name
            self.proxy_base = name
            self.absolute_url = absolute_url
            self.requested_port = port

        @property
        def process_args(self):
            return {
                'port': self.port,
                'base_url': self.base_url,
            }

        def _render_template(self, value):
            args = self.process_args
            if type(value) is str:
                return value.format(**args)
            elif type(value) is list:
                return [self._render_template(v) for v in value]
            elif type(value) is dict:
                return {
                    self._render_template(k): self._render_template(v)
                    for k, v in value.items()
                }
            else:
                raise ValueError('Value of unrecognized type {}'.format(type(value)))

        def get_cmd(self):
            if callable(command):
                return self._render_template(call_with_asked_args(command, self.process_args))
            else:
                return self._render_template(command)

        def get_env(self):
            if callable(environment):
                return self._render_template(call_with_asked_args(environment, self.process_args))
            else:
                return self._render_template(environment)

        def get_timeout(self):
            return timeout

    return _Proxy
228431
function proxyObjErrors (proxyObj) {
  if (!proxyObj) { return '`proxyObj` not defined'; }

  let errors   = '';
  let expected = ['req', 'req', 'reqOpts', 'options'];

  _.each(expected, function (expect, index) {
    if (!proxyObj[expect]) {
      errors += (index ? ', ' : '') + 'Missing property: `' + expect + '`';
    }
  });

  return errors ? 'Errors found in `proxyObj`: [' + errors + ']' : false;
}
403630
function(proxies, namespace, serverType, proxy) {
  proxies[namespace] = proxies[namespace] || {};
  if (proxies[namespace][serverType]) {
    for (let attr in proxy) {
      proxies[namespace][serverType][attr] = proxy[attr];
    }
  } else {
    proxies[namespace][serverType] = proxy;
  }
}
1105280
function makeServeMiddleware(/* config */) {
  return function handle(req, resp, next) {
    if (/^\/.*\.css$/.test(req.url)) {
      resp.end("");
    }
    else {
      next();
    }
  };
}
303622
def add_shared_configs(p, base_dir=''):
    
    p.add('--host', default='localhost',
          help="Service host")
    p.add('--port', '-p', type=int, default=8000,
          help="Service port")
    p.add('--app-host', default=None,
          help="Local application host for reverse proxy deployment, "
               "as opposed to service --host (must also specify --app-port)")
    p.add('--app-port', type=int, default=None,
          help="Local application port for reverse proxy deployment, "
               "as opposed to service --port (must also specify --app-host)")
    p.add('--image-dir', '-d', default=os.path.join(base_dir, 'testimages'),
          help="Image file directory")
    p.add('--generator-dir', default=os.path.join(base_dir, 'iiif/generators'),
          help="Generator directory for manipulator='gen'")
    p.add('--tile-height', type=int, default=512,
          help="Tile height")
    p.add('--tile-width', type=int, default=512,
          help="Tile width")
    p.add('--gauth-client-secret', default=os.path.join(base_dir, 'client_secret.json'),
          help="Name of file with Google auth client secret")
    p.add('--include-osd', action='store_true',
          help="Include a page with OpenSeadragon for each source")
    p.add('--access-cookie-lifetime', type=int, default=3600,
          help="Set access cookie lifetime for authenticated access in seconds")
    p.add('--access-token-lifetime', type=int, default=10,
          help="Set access token lifetime for authenticated access in seconds")
    p.add('--config', is_config_file=True, default=None,
          help='Read config from given file path')
    p.add('--debug', action='store_true',
          help="Set debug mode for web application. INSECURE!")
    p.add('--verbose', '-v', action='store_true',
          help="Be verbose")
    p.add('--quiet', '-q', action='store_true',
          help="Minimal output only")
858793
protected void loadMavenProxy() {
        if (null == settings) {
            return;
        }

        Proxy mvnProxy = settings.getActiveProxy();
        if (mvnProxy != null) {
            ProxyConfiguration newProxyConfiguration = new ProxyConfiguration();
            newProxyConfiguration.setHost(mvnProxy.getHost());
            newProxyConfiguration.setPort(mvnProxy.getPort());
            newProxyConfiguration.setUsername(mvnProxy.getUsername());
            newProxyConfiguration.setPassword(mvnProxy.getPassword());
            newProxyConfiguration.setHostExclusions(mvnProxy.getNonProxyHosts());
            proxyConfig = newProxyConfiguration;
            getLog().info("Maven proxy loaded successfully");
        } else {
            getLog().warn("No maven proxy found, however useMavenProxy is set to true!");
        }
    }
1297695
function ProxyGuest ( options ) {
	// prepare
	var name;

	// connection with server
	this.active = false;

	/**
	 * proxy instance configuration
	 * @namespace
	 */
	this.config = {
		// node.js server address
		host: '127.0.0.1',

		// http server port
		port: 8800,

		// session name
		name: 'anonymous',

		// cached url for posting requests
		urlPost: '',

		// cached url for info collecting
		urlInfo: ''
	};

	// single ajax object for performance
	this.xhr = new XMLHttpRequest();

	// validate and iterate input
	if ( options && typeof options === 'object' ) {
		for ( name in options ) {
			// rewrite defaults
			if ( options.hasOwnProperty(name) ) {
				this.config[name] = options[name];
			}
		}
	}

	// there may be some special chars
	name = encodeURIComponent(this.config.name);

	// cache final request urls
	this.config.urlPost = 'http://' + this.config.host + ':' + this.config.port + '/' + name;
	this.config.urlInfo = 'http://' + this.config.host + ':' + this.config.port + '/info/' + name;

	// check initial connection status
	this.active = this.info().active;

	console.log('%c[core]\t%c%s\t%c0\t%cconnection to the host %c(%s:%s): %c%s',
		'color:grey',
		'color:purple', this.config.name,
		'color:grey',
		'color:black',
		'color:grey', this.config.host, this.config.port,
		'color:' + (this.active ? 'green' : 'red'), this.active ? 'available' : 'not available'
	);
}