Giter VIP home page Giter VIP logo

elixir-reverse-proxy's Introduction

ReverseProxy

Build Status Coverage Status

A Plug based, reverse proxy server.

ReverseProxy can act as a standalone service or as part of a plug pipeline in an existing application.

From Wikipedia:

In computer networks, a reverse proxy is a type of proxy server that retrieves resources on behalf of a client from one or more servers. These resources are then returned to the client as though they originated from the proxy server itself. While a forward proxy acts as an intermediary for its associated clients to contact any server, a reverse proxy acts as an intermediary for its associated servers to be contacted by any client.

Goals

  • Domain based proxying
  • Path based proxying
  • Proxy cache
  • SSL/TLS termination

Non-goals

  • Replace production reverse proxy solutions

Configuration

:upstreams

Upstream servers can be listed per-domain in the following forms:

  • List of remote nodes, e.g. ["host:4000", "host:4001"]
  • A {plug, options} tuple, useful for umbrella applications

Note: This structure may change in the future as the project progresses.

config :reverse_proxy,
  # ...
  upstreams: %{ "api." => ["localhost:4000"],
                "slogsdon.com" => ["localhost:4001"] }

:cache

Enables the caching of the responses from the upstream server.

Note: This feature has not yet been built to completion. The current implementation treats all requests as hit misses.

config :reverse_proxy,
  # ...
  cache: false

Running

plug_adapter = Plug.Adapters.Cowboy
options = []
adapter_options = []

plug_adapter.http ReverseProxy.Router, options, adapter_options

Embedding

ReverseProxy can be embedded into an existing Plug application to proxy requests to required resources in cases where CORS or JSONP are unavailable.

Note: This feature has not been thoroughly flushed out, so it might not yet act as described.

The following code leverages Plug.Router.forward/2 to pass requests to the /google path to ReverseProxy:

defmodule PlugReverseProxy.Router do
  use Plug.Router

  plug :match
  plug :dispatch

  forward "/google", to: ReverseProxy, upstream: ["google.com"]
end

License

ReverseProxy is released under the MIT License.

See LICENSE for details.

elixir-reverse-proxy's People

Contributors

scottmessinger avatar skylerparr avatar slogsdon avatar tt 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.