Security News
tea.xyz Spam Plagues npm and RubyGems Package Registries
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
proxy
Advanced tools
Readme
This module provides standard "HTTP proxy" logic. You can script your own server
using the proxy
server API. Be sure to take a look at the "Examples" section
below.
There is also a companion proxy(1)
CLI tool, which spawns an HTTP(s) proxy
server with the specified options.
You could think of proxy(1)
as similar to some of the other popular open
source HTTP proxy software:
A basic HTTP(s) server with all the default options. All requests are allowed. CONNECT HTTP method works as well.
import * as http from 'http';
import { createProxy } from 'proxy';
const server = createProxy(http.createServer());
server.listen(3128, () => {
var port = server.address().port;
console.log('HTTP(s) proxy server listening on port %d', port);
});
The proxy(1)
CLI tool can be used to spawn HTTP(s) proxy server instances with
various options.
Pass the -p
/--port
option to with a port number to specify a TCP port to
bind to. Defaults to 3128 if none is specified.
$ proxy --port 8080
Proxy-Authenticate
commandPass the -a
/--authenticate
switch with a command to execute when the client
Proxy-Authorization
header is given. This command determines whether or not the
request is authorized based on the "exit code" of the command.
The relevant request authentication information is passed in as
PROXY_AUTH_USERNAME
, PROXY_AUTH_PASSWORD
and PROXY_AUTH_SCHEME
environment
variables.
For example, to authorize "Basic" authentication with username "foo" and password "bar":
$ proxy --authenticate 'if \
[ "$PROXY_AUTH_USERNAME" = "foo" ] && \
[ "$PROXY_AUTH_PASSWORD" = "bar" ]; \
then exit 0; \
fi; \
exit 1;'
Pass the -l
/--local-address
argument with an IP address of the network
interface to send the outgoing requests through. It is the equivalent of setting
a localAddress
field in the options when calling http.request()
.
$ proxy --local-address 192.168.0.10
(The MIT License)
Copyright (c) 2013 Nathan Rajlich <nathan@tootallnate.net>
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the 'Software'), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
FAQs
An HTTP proxy written with Node.js (think Squid)
The npm package proxy receives a total of 76,124 weekly downloads. As such, proxy popularity was classified as popular.
We found that proxy demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
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.
Security News
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Security News
As cyber threats become more autonomous, AI-powered defenses are crucial for businesses to stay ahead of attackers who can exploit software vulnerabilities at scale.
Security News
UnitedHealth Group disclosed that the ransomware attack on Change Healthcare compromised protected health information for millions in the U.S., with estimated costs to the company expected to reach $1 billion.