# hitchy-plugin-proxy

> hitchy plugin forwarding requests to remote servers

Latest version **0.0.5** (published 2019-11-05) · MIT license · 0 weekly downloads

> **Deprecated.** This package is deprecated.

## Install

```sh
npm install hitchy-plugin-proxy
pnpm add hitchy-plugin-proxy
yarn add hitchy-plugin-proxy
bun add hitchy-plugin-proxy
```

## Health

**Score 10/100 (F)** — status: deprecated.

Negative: deprecated.

## Facts

| | |
|---|---|
| Version | 0.0.5 |
| Published | 2019-11-05 |
| First published | 2018-11-03 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 14.5 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | cepharum GmbH |
| Maintainers | soletan |
| Keywords | hitchy, proxy |

## Links

- npm: https://www.npmjs.com/package/hitchy-plugin-proxy
- Repository: https://github.com/hitchyjs/plugin-proxy
- Homepage: https://github.com/hitchyjs/plugin-proxy#readme
- Issues: https://github.com/hitchyjs/plugin-proxy/issues
- npm.io page: https://npm.io/package/hitchy-plugin-proxy

## Recent versions

- 0.0.5 (latest) — 2019-11-05
- 0.0.4 — 2019-03-10
- 0.0.3 — 2019-03-10
- 0.0.2 — 2019-01-05
- 0.0.1 — 2018-11-03

## README

# hitchy-plugin-proxy

hitchy plugin adding support for redirecting requests to remote server

## License

[MIT](LICENSE)

## Installation

```bash
npm i -S hitchy-plugin-proxy
```

## Configuration

Create a file **config/proxy.js** in your Hitchy-based project. This file contains all proxy configurations:

```javascript
exports.proxy = [
	{
		prefix: "/ddg",
		target: "https://duckduckgo.com/",
		alias: "https://ddg.com/",
	},
	{
		prefix: "/denic",
		target: "https://www.denic.de",
	},
];
```

The exported list must be named **proxy**. It consists of objects each declaring a routing prefix and a target all requests matching prefix are mapped onto. Additional options may be introduced in future and should be provided here as well.

> **Example:**
> 
> The configuration above is creating two reverse proxies: The first one is forwarding all requests for routes starting with **/ddg** to the base URL **https://duckduckgo.com** so that requesting **/ddg/assets/dax.svg** will eventually deliver the resource available at **https://duckduckgo.com/assets/dax.svg**. The second one is forwarding requests with prefix **/denic** to **http://www.denic.de**.

### Aliases

Every proxy may declare one or more aliases used on mapping URls returned from target back into address space used in request sent to the proxy itself.

> **Example**
>
> In example above a request redirecting to URL `https://duckduckgo.com/index.html` is translated to redirecting to `/ddg/index.html` instead. This translation would fail if target would redirect to `https://ddg.com/index.html` and this URL would be returned from proxy as well. By declaring the alias even this URL would be translated to `/ddg/index.html`.

Aliases are useful e.g. to test and develop backends prepared to run at different URL when in production setup.

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