GithubHelp home page GithubHelp logo

node-proxies's Introduction

Evolving Web Node Proxies

Several node.js-based proxy servers. Currently of interest are

  • solrProxy.js
  • scriptInjector.js

Setup

curl http://npmjs.org/install.sh | sh         # install npm
npm install                                   # install dependencies

solrProxy.js

NOTE: For a more up-to-date implementation, see solr-security-proxy

A node module for building reverse proxies to protect a solr instance exposed to the internet.

You need to define your own query filter function and use it to create a proxy. See solrQueryFilter.js for an example query filter and solrProxyExample.js for a working proxy.

Setting up a proxy server

var solrProxy = require('PATH/solrProxy');

solrProxy.createProxy(proxyOptions, queryFilter).listen(4321);

proxyOptions is an object which defines how the proxy behaves --- including where it proxies to. Nearly always you will want something like the following:

var proxyOptions = {
  host: 'example.com',
  port: 1234
}

See solrProxyExample.js for a working example.

Writing your own query filter

A query filter is a function that returns true or false depending on whether the given query should be proxied to Solr or rejected outright.

As arguments the function takes an httpRequest object, an object which contains just the parsed query, and the handler to which the query was sent.

See solrQueryFilter.js for a more complete example.

scriptInjector.js

A proxy that allows you to inject arbitrary javascript into a webpage by passing it through a proxy. Most useful when combined with the following bookmarklet (or some alteration thereof):

javascript: document.location = "http://localhost:9000?dest=" + document.location

In its simpliest form (that above), the proxy injects jQuery and nothing else. To inject other scripts, add to the GET arguments:

&script=example.com/script.js,mysite.localhost/scripts/stuff.js,...

Currently jQuery is injected always, without regard to whether or not the site has it to begin with.

node-proxies's People

Contributors

dergachev avatar jhnlsn avatar tgetgood avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.