# host-proxy

> Fast, lightweight and transparent http(s) proxy that supports dynamic hostnames.

Latest version **1.0.2** (published 2016-11-25) · MIT license · 0 weekly downloads

## Install

```sh
npm install host-proxy
pnpm add host-proxy
yarn add host-proxy
bun add host-proxy
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.2 |
| Published | 2016-11-25 |
| First published | 2016-03-08 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 16 |
| Author | Dylan Piercey |
| Maintainers | dylanpiercey |
| Keywords | forward, host, hosts, proxy, redirect, virtual |

## Links

- npm: https://www.npmjs.com/package/host-proxy
- Repository: https://github.com/DylanPiercey/host-proxy
- Issues: https://github.com/DylanPiercey/host-proxy/issues
- npm.io page: https://npm.io/package/host-proxy

## Recent versions

- 1.0.2 (latest) — 2016-11-25
- 1.0.1 — 2016-11-25
- 1.0.0 — 2016-11-25
- 0.3.1 — 2016-07-26
- 0.3.0 — 2016-03-22
- 0.2.2 — 2016-03-12
- 0.2.1 — 2016-03-09
- 0.2.0 — 2016-03-09
- 0.1.0 — 2016-03-08

## README

# HOST-PROXY
Fast, lightweight and transparent http(s) proxy that supports dynamic hostnames.

# Installation

#### Npm
```console
npm install host-proxy
```

# Example

```javascript
var createProxy = require('host-proxy');

// Start a proxy server.
createProxy(function (hostname, secure) {
	// Respond with an address to proxy to.
	// Result is passed to net.createConnection.
	return ({
		"test.com": "http://localhost:3002",
		"secure.test.com": "https://localhost:3003",
		"search.test.com": "http://google.ca",
		"api.test.com": { port: 12345, family: 'IPv4', address: "127.0.0.1" }
	})[hostname];
}).listen(80);
```

### The above example creates the following proxy:

* **test.com** -> http://localhost:3002
* **secure.test.com** -> https://localhost:3003
* **search.test.com** -> http://google.ca
* **api.test.com** -> http://localhost:12345

### Contributions

* Use npm to run tests.

Please feel free to create a PR!

---
_Source: https://npm.io/package/host-proxy · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
