Skip to content

A reverse proxy for cowboy using the erlang httpc client. 🤠

License

Notifications You must be signed in to change notification settings

SachsKaylee/cowboy_reverse_proxy

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

cowboy_reverse_proxy

A reverse proxy for cowboy using the erlang httpc client.

Usage example:

{"/proxy/[...]", cowboy_reverse_proxy, [
  {host, "example.com"}, 
  {protocol, "https"}
]}

This proxies all incoming requests under /proxy to https://example.com/proxy. The path is being kept.

Options

Available proplist options for the cowboy handler are:

  • host (required): The host to proxy to. If a non default port is required add the port to this value. (e.g. "sahnee.dev:444")

  • protocol (default: "http"): The protocol to proxy. Can technically be any string but only "http" and "https" are officially supported.

  • change_host (default: false): Should the "host" header be changed to the value specified in the host option. This can be useful for bypassing cross origin checks by pretending that the frontend of the server you are proxying to made the request.

  • modify_path (default: identity/1): An arity 1 function that gets passed the path of every request as a charlist which can modify it. Useful if the proxy path is not the same as the one being proxied to.

  • disable_proxy_headers (default: false): Disables all x-proxy headers sent by this proxy. You want to set this for security hardening.

  • use_forwarded_for (default: false): Adds or updates the "x-forwarded-for" header with the peer IP of the client the request is proxied for. Use this to "play nice" and tell the servers you are proxying on whose behalf your request was made.

Advanced options:

Build

$ rebar3 compile

About

A reverse proxy for cowboy using the erlang httpc client. 🤠

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages