aerys-reverse icon indicating copy to clipboard operation
aerys-reverse copied to clipboard

Reverse HTTP proxy handler for Aerys

Aerys Reverse

License

amphp/aerys-reverse is a reverse HTTP proxy handler for use with the Aerys webserver.


EXPERIMENTAL, USE AT YOUR OWN RISK!


Required PHP Version

  • PHP 7.0+

Installation

composer require amphp/aerys-reverse

Usage

<?php

return (new Aerys\Host)
    ->use(new Aerys\ReverseProxy("https://amphp.org/", ["Host" => ["amphp.org"]]);

Now all requests to the webserver are reverse proxied to https://amphp.org/, with all the headers preserved and the Host header set to amphp.org.

Alternatively one also can pass a callable as second parameter, which then gets all the headers in and should return the headers to send.

As optional third argument an Amp\Artax\Client instance can be passed (should use NullCookieJar) to setup certain options.