GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - slogsdon/elixir-reverse-proxy: Plug-based reverse proxy in Elixir — drop in front of services for routing, header rewrites, basic load balancing.

BranchesTags
Open more actions menu

Latest commit

 

History

44 Commits
44 Commits

Folders and files

NameName
Last commit message
Last commit date
config
config
 
 
example
example
 
 
lib
lib
 
 
test
test
 
 
.gitignore
.gitignore
 
 
.travis.yml
.travis.yml
 
 
LICENSE
LICENSE
 
 
README.md
README.md
 
 
mix.exs
mix.exs
 
 
mix.lock
mix.lock
 
 

Repository files navigation

shane.logsdon.io — writing and projects on agentic workflows, web standards, and payments engineering.

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.

About

Plug-based reverse proxy in Elixir — drop in front of services for routing, header rewrites, basic load balancing.

hex.pm/packages/reverse_proxy

Topics

elixirhttpplugproxy-serverreverse-proxy

Resources

Readme
MIT license
Activity

Stars

146 stars

Watchers

5 watching

Forks

34 forks
Report repository

Releases

Packages

Used by

Contributors

Languages

You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.