• Stars
    star
    146
  • Rank 252,769 (Top 5 %)
  • Language
    Elixir
  • License
    MIT License
  • Created over 9 years ago
  • Updated over 7 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

A Plug based, reverse proxy server written in Elixir.

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. ["http://host:4000", "http://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: %{ "foobar.localhost" => ["http://www.example.com"],
                "api." => ["http://localhost:4000"],
                "slogsdon.com" => ["http://localhost:4001"] }

You might need to create foobar.localhost in /etc/hosts` and replace example.com with an actual site.

: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.

More Repositories

1

placid

A REST toolkit for building highly-scalable and fault-tolerant HTTP APIs with Elixir
Elixir
190
star
2

vagrant-phalcon

a template for using Vagrant for developing PHP applications with Phalcon
Ruby
73
star
3

plug-web-socket

An exploration into a stand-alone library for Plug applications to easily adopt WebSockets.
Elixir
62
star
4

mandrill-elixir

a Mandrill wrapper for Elixir
Elixir
51
star
5

elixir-control

An exploratory look into functors, applicatives, and monads for Elixir
Elixir
24
star
6

parcel-plugin-fable

Parcel asset type plugin for Fable
JavaScript
21
star
7

web-development-using-elixir

17
star
8

stripe-elixir

Elixir
15
star
9

acvte

a blog written in go, based off of obtvse2 / svbtle
JavaScript
15
star
10

php-web-component-ssr

Provides server-side rendering support for native web components / custom elements
PHP
15
star
11

b

A static-ish blog application. Can be run as a standalone applicaiton or be used to manage and deploy posts to a remote server.
Go
14
star
12

http

HTTP server for Elixir
Elixir
12
star
13

Fable.Template.JavaScriptLibrary

dotnet new template for building JavaScript projects with Fable + FSharp
F#
9
star
14

staticwp

Converts your WordPress blog into a static site
PHP
8
star
15

vagrant-weber

a template for using Vagrant for developing Elixir applications with Weber
Shell
7
star
16

sap

A toolkit for Plug applications to accept and respond to HTTP requests by using a decision tree built with combinators
Elixir
7
star
17

nuxt-demo

JavaScript
6
star
18

elixir_playground

Elixir
6
star
19

jsx-for-web-components

WIP: A basic JSX factory for use in projects leveraging web components
TypeScript
6
star
20

javascript-web-component-hydration

Thin wrapper around HTMLElement to support hydration of server-side rendered custom elements
JavaScript
6
star
21

pool

Socket acceptor pool for Elixir
Elixir
6
star
22

elixir-raft

A Raft implementation
Elixir
5
star
23

elixir-nicta-course

Functional Programming Course for Elixir, modeled after the NICTA course for Haskell
Elixir
5
star
24

slate-for-jekyll

Beautiful static documentation for your API
JavaScript
5
star
25

presentation-functional-programming-in-elixir

Elixir
4
star
26

dotfiles

Perl
3
star
27

develop-on-docker

A set of Docker images to aid development in containers
3
star
28

webapi-angular2-demo

A demo for using ASP.NET 5, WebAPI, and Angular 2 in harmony
C#
3
star
29

php-flat-file

Fast static-site generator / flat-file CMS
PHP
3
star
30

IntroToJavascript

A primer into programming in Javascript
2
star
31

EncodingStatus

Batch FFmpeg administration
PHP
2
star
32

elixir-hex-deps-checker

Check your Hex dependencies for updates
Elixir
2
star
33

reasonably-reactive-rust

Demo/starter project using Reason + React and Rust + Rocket
OCaml
2
star
34

docker-build-service

Provides a build service for code using docker containers
Go
1
star
35

php-fp-web

test bed for a functional PHP web toolkit
PHP
1
star
36

chicagoboss_angular

A ChicagoBoss template with Brunch
Erlang
1
star
37

presentation-plug-friend-of-web-developers

Elixir
1
star
38

bsb-native-starter

Quick/simple starter project for bsb-native and Reason/OCaml
OCaml
1
star
39

gp-node-sdk

JavaScript
1
star
40

editor

Elixir
1
star
41

language-web-shootout

Web shootout between some recently used languages
Clojure
1
star
42

now-static-demo

A minimal example for using now.sh for deploying static sites
HTML
1
star
43

globalpayments-gateway-provider-for-woocommerce

PHP
1
star
44

php-fluent-interfaces

some ways to create Fluent Interfaces in PHP
PHP
1
star
45

rust-wasm-demo

Demo/starter project using Rust and WebAssembly
Rust
1
star
46

global-elixir

Elixir
1
star
47

sugarcookie

Generate and verify value signatures for secure cookies.
Go
1
star
48

php-flat-file-starter

Starter project for flat-file
Dockerfile
1
star
49

test-the-planet

Code for an Elixir workshop covering testing with ExUnit.
Elixir
1
star