# @abai/proxy

> Web proxy library for rewriting remote websites

Latest version **5.0.7** (published 2019-08-09) · 0 weekly downloads

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

## Install

```sh
npm install @abai/proxy
pnpm add @abai/proxy
yarn add @abai/proxy
bun add @abai/proxy
```

## Health

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

Negative: deprecated.

## Facts

| | |
|---|---|
| Version | 5.0.7 |
| Published | 2019-08-09 |
| First published | 2019-01-14 |
| Weekly downloads | 0 |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 10 |
| Unpacked size | 58.8 KB |
| Known vulnerabilities | 0 (+1 in 1 direct dependencies) |
| Install scripts | no |
| Maintainers | abai |

## Links

- npm: https://www.npmjs.com/package/@abai/proxy
- npm.io page: https://npm.io/package/@abai/proxy

## Dependencies (10)

- [tld](https://npm.io/package/tld.md) 0.0.2
- [mime](https://npm.io/package/mime.md) ^2.3.1
- [async](https://npm.io/package/async.md) ^2.0.0
- [debug](https://npm.io/package/debug.md) ^4.0.1
- [cookie](https://npm.io/package/cookie.md) ^0.3.1
- [lodash](https://npm.io/package/lodash.md) ^4.17.11
- [base-64](https://npm.io/package/base-64.md) ^0.1.0
- [iconv-lite](https://npm.io/package/iconv-lite.md) ^0.4.13
- [content-type](https://npm.io/package/content-type.md) ^1.0.1
- [set-cookie-parser](https://npm.io/package/set-cookie-parser.md) ^2.2.1

## Recent versions

- 5.0.7 (latest) — 2019-08-09
- 5.0.3 — 2019-07-17
- 5.0.2 — 2019-07-17
- 5.0.1 — 2019-07-17
- 5.0.0 — 2019-06-03
- 1.0.0 — 2019-04-24
- 4.0.4 — 2019-04-24
- 0.0.4 — 2019-02-21
- 0.0.3 — 2019-02-21
- 0.0.2 — 2019-01-23
- 0.0.1 — 2019-01-14

## README

# @abai/proxy

All data is processed and relayed to the client on the fly without unnecessary buffering, making unblocker one of the fastest web proxies available.

### Method

The script uses "pretty" urls which, besides looking pretty, allow links with relative paths
to just work without modification. (E.g. `<a href="path/to/file2.html"></a>`)

In addition to this, links that are relative to the root (E.g. `<a href="/path/to/file2.html"></a>`)
can be handled without modification by checking the referrer and 307 redirecting them to the proper
location in the referring site. (Although the proxy does attempt to rewrite these links to avoid the redirect.)

Cookies are proxied by adjusting their path to include the proxy's URL, and a bit of extra work is done to ensure they
remain intact when switching protocols or subdomains.

### Limitations

Although the proxy works well for standard login forms and even most AJAX content, OAuth login forms and anything that uses
[postMessage](https://developer.mozilla.org/en-US/docs/Web/API/Window/postMessage) (Google, Facebook, etc.) are not
likely to work out of the box. This is not an insurmountable issue, but it's not one that I expect to have fixed in the
near term. Patches are welcome, including both a general-purpose fix to go into the main library, and site-specific
fixes to go in the examples folder.

### Example

```js
const Proxy = require('@abai/proxy');

const express = require('express');
const app = express();

app.use(new Proxy({ prefix: '/proxy/' }));

app.get('/', (req, res) => {
  // ...
});
```

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