@abai/proxy
Web proxy library for rewriting remote websites
Last updated 10 months ago by abai .
Original npm · Tarball · package.json
$ cnpm install @abai/proxy 
SYNC missed versions from official npm registry.

@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 (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

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

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

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

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

Current Tags

  • 5.0.7                                ...           latest (10 months ago)

11 Versions

  • 5.0.7                                ...           10 months ago
  • 5.0.3 [deprecated]           ...           a year ago
  • 5.0.2 [deprecated]           ...           a year ago
  • 5.0.1 [deprecated]           ...           a year ago
  • 5.0.0                                ...           a year ago
  • 1.0.0                                ...           a year ago
  • 4.0.4 [deprecated]           ...           a year ago
  • 0.0.4 [deprecated]           ...           a year ago
  • 0.0.3 [deprecated]           ...           a year ago
  • 0.0.2 [deprecated]           ...           a year ago
  • 0.0.1 [deprecated]           ...           a year ago
Maintainers (1)
Downloads
Today 1
This Week 2
This Month 2
Last Day 0
Last Week 11
Last Month 34
Dependencies (10)
Dev Dependencies (3)
Dependents (1)

Copyright 2014 - 2016 © taobao.org |