New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

koa2-pixie-proxy

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

koa2-pixie-proxy

A simple but flexible proxy middlware for koa2

  • 2.0.3
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1
decreased by-80%
Maintainers
1
Weekly downloads
 
Created
Source

#koa2-pixie-proxy Build Status

A simple but flexible proxy middlware for koa2. Forked from koa-pixie-proxy due to lack of support for Koa2.

Installation

npm i --save koa2-pixie-proxy

Usage

const pixie = require('koa2-pixie-proxy');
const Koa = require('koa');
const router = require('koa-router');

const app = new Koa();
app.use(router(app));

var proxy = pixie({host: 'http://example.com'});

// Proxy requests to server/hurp to example.com/durp
app.get('/hurp', proxy('/durp'));

// works with url params as long as they match the url params
// in the request to your server
app.get('some/:param/here/:id', proxy('someother/:param/maybesomethingelse/:id/durp'));

// if you leave out a url it proxies to host + this.url
app.post('/foobar', proxy());

To allow later middleware to modify the response, koa2-pixie-proxy will set response headers, status and body but won't actually send the result to the client. This means you give up nice proxy pipelining, but you can do things like modify the result of a proxy like this:

app.get('/hurp', proxy('/durp'), (ctx) => {
  // add a property to the body already proxied
  ctx.body.beans = 'baz';
});

Keywords

FAQs

Package last updated on 16 Jan 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc