Coder Social home page Coder Social logo

proxylet's Introduction

Status: Unmaintained

No Maintenance Intended

I am no longer actively maintaining this project.

proxylet: lightweight HTTP reverse proxy built on eventlet

This module implements a lightweight reverse proxy for HTTP, using non-blocking IO based on the eventlet module. It aims to do as little as possible while supporting simple request/response rewriting and being compatible with HTTP keep-alive.

Basic operation is via the 'serve' function, which will bind to the specified host and port and start accepting incoming HTTP requests:

proxylet.serve(host,port,mapper)

Here 'mapper' is a function taking a proxylet.streams.HTTPRequest object, and returning either None (for '404 Not Found') or a 3-tuple giving the destination host, destination port, and a rewriter object.

The rewriter can be any callable that takes request and response streams as arguments and returns wrapped versions of them, but it will most likely be a subclass of proxylet.relocate.Relocator. This class has the necessary logic to rewrite the request for proxying.

As an example of the available functionality, this mapping function will proxy requests to /svn to a private subversion server, requests to /files to a private fileserver, and return 404 for any other paths:

def mapper(req): svn = SVNRelocator("http://www.example.com/svn","http://svn.example.com/") if svn.matchesLocal(req.reqURI): return svn.mapping # contains the (host,port,rewriter) tuple if req.reqURI.startswith("/files/"): return ("files.example.com",80,None) return None

proxylet's People

Contributors

rfk avatar

Watchers

 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.