# foxy

> Proxy with response modding

Latest version **11.1.5** (published 2016-03-22) · MIT license · 0 weekly downloads

## Install

```sh
npm install foxy
pnpm add foxy
yarn add foxy
bun add foxy
```

Provides the command `foxy`.

## 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 | 11.1.5 |
| Published | 2016-03-22 |
| First published | 2014-05-14 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 7 |
| Known vulnerabilities | 0 (+3 in 2 direct dependencies) |
| Install scripts | no |
| GitHub stars | 18 |
| Author | Shane Osbourne |
| Maintainers | shakyshane |
| Keywords | proxy |

## Links

- npm: https://www.npmjs.com/package/foxy
- Repository: https://github.com/shakyshane/foxy
- Homepage: https://github.com/shakyshane/foxy#readme
- Issues: https://github.com/shakyshane/foxy/issues
- npm.io page: https://npm.io/package/foxy

## Dependencies (7)

- [meow](https://npm.io/package/meow.md) ^3.1.0
- [dev-ip](https://npm.io/package/dev-ip.md) ^1.0.1
- [connect](https://npm.io/package/connect.md) ^3.3.5
- [http-proxy](https://npm.io/package/http-proxy.md) ^1.9.0
- [eazy-logger](https://npm.io/package/eazy-logger.md) ^2.0.0
- [lodash.merge](https://npm.io/package/lodash.merge.md) ^3.3.1
- [resp-modifier](https://npm.io/package/resp-modifier.md) ^4.0.2

## Recent versions

- 11.1.5 (latest) — 2016-03-22
- 11.1.4 — 2015-11-28
- 11.1.3 — 2015-08-06
- 11.1.2 — 2015-08-04
- 11.1.1 — 2015-07-18
- 11.1.0 — 2015-07-18
- 11.0.4 — 2015-06-25
- 11.0.3 — 2015-06-17
- 11.0.2 — 2015-06-11
- 11.0.1 — 2015-06-11
- 11.0.0 — 2015-05-22
- 10.1.2 — 2015-05-03
- 10.1.1 — 2015-03-31
- 10.1.0 — 2015-03-29
- 10.0.2 — 2015-02-12
- … 37 more at https://npm.io/package/foxy/versions

## README

##Foxy 
[![Travis branch](https://img.shields.io/travis/shakyShane/foxy/master.svg?style=flat-square&label=linux)](https://travis-ci.org/shakyShane/foxy)
[![AppVeyor branch](https://img.shields.io/appveyor/ci/shakyshane/foxy/master.svg?style=flat-square&label=windows)]()

Proxy with response moddin'

##cli
First, install globally
```bash
$ npm install -g foxy
```

Then, if you wanted to proxy a local vhost such as `http://magento.dev` run:
```bash
$ foxy http://magento.dev
```

A random port will be used, but if you want to provide your own:
```bash
$ foxy http://magento.dev --port 3000
```

##api
```js
var foxy = require("foxy");

var proxy = foxy("http://localhost:3000").listen(8000);

// Now access the site through http://localhost:8000
```

Built-in middleware will re-write html on the fly to update any urls & there'll also be the option
for additional rules for the re-writing.

## Additional re-write rules

Let's say you want to change the text `Home Page` to be `Homepage Rocks`, you can do that easily by 
providing additional `rules`

```js
var foxy = require("foxy");

var config = {
    rules: [
        {
            match: /Home Page/g,
            fn: function () {
                return "Homepage Rocks"
            }
        }
    ]
};

var proxy = foxy("http://localhost:3000", config).listen(8000);
```

## white/black lists

You can force some paths to always be processed by the middlewares.

```js
var proxy = foxy("http://wordpress.dev", {
    whitelist: ["/wp-admin/admin-ajax.php"], // whitelist checked first
    blacklist: ["/wp-admin/**"],
}).listen(8000);
```

## proxyResponse middleware

You can add middleware-like functions which process the proxy response.

```js
var foxy = require("foxy");

var config = {
    proxyRes: [
        function(proxyRes, req, config) {
            // do something with the proxyRes object which comes from node-http-proxy
        }
    ]
};

var proxy = foxy("http://localhost:3000", config).listen(8000);
```

#TODO

- [ ] https

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