Yahns ProxyPass

Methods

::new

class Yahns::ProxyPass

Yahns::ProxyPass is a Rack (hijack) app which allows yahns to act as a fully-buffering reverse proxy to protect backends from slow HTTP clients.

Yahns::ProxyPass relies on the default behavior of yahns to do full input and output buffering. Output buffering is lazy, meaning it allows streaming output in the best case and will only buffer if the client cannot keep up with the server.

The goal of this reverse proxy is to act as a sponge on the same LAN or host to any backend HTTP server not optimized for slow clients. Yahns::ProxyPass accomplishes this by handling all the slow clients internally within yahns itself to minimize time spent in the backend HTTP server waiting on slow clients.

It does not do load balancing (we rely on Varnish for that). Here is the exact config we use with Varnish, which uses the :response_headers option to hide some Varnish headers from clients:

run Yahns::ProxyPass.new('http://127.0.0.1:6081',
        response_headers: {
          'Age' => :ignore,
          'X-Varnish' => :ignore,
          'Via' => :ignore
        })

This is NOT a generic Rack app and must be run with yahns. It uses rack.hijack, so compatibility with logging middlewares (e.g. Rack::CommonLogger) is not great and timing information gets lost.

This provides HTTPS termination for our mail archives: yhbt.net/yahns-public/

See yhbt.net/yahns.git/tree/examples/https_proxy_pass.conf.rb and yhbt.net/yahns.git/tree/examples/proxy_pass.ru for examples

Public Class Methods

new (dest, opts = { response_headers: { 'Server' => :ignore } }) source

dest must be an HTTP URL with optional variables prefixed with '$'. dest may refer to the path to a Unix domain socket in the form:

unix:/absolute/path/to/socket

Variables which may be used in the dest parameter include:

For Unix domain sockets, variables may be separated from the socket path via: ":/". For example:

unix:/absolute/path/to/socket:/$host/$fullpath

Currently :response_headers is the only opts supported. :response_headers is a Hash containing a "from => to" mapping of response headers. The special value of :ignore indicates the header from the backend HTTP server will be ignored instead of being blindly passed on to the client.


Pages Classes Methods
mail archives: https://yhbt.net/yahns-public/
	nntp://news.public-inbox.org/inbox.comp.lang.ruby.yahns 
	 
public: yahns-public@yhbt.net
source code: git clone https://yhbt.net/yahns.git