Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

frdl/proxy

Open more actions menu

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

80 Commits
80 Commits
 
 
 
 
 
 
 
 

Repository files navigation

frdl/proxy

Simple Php Proxy based on Guzzle.

Installation

Use Composer...

composer require frdl/proxy

...or the Webfan Installer if you would like to build a larger project.

Usage

<?php
use frdl\Proxy\Proxy;

 require 'vendor/autoload.php'; 
 
 	$proxy = (new Proxy(null,
                      $_SERVER['REQUEST_URI'],
                      'green.example.com',  //target host
                      $_SERVER['HTTP_HOST'],  //User Input, forward optionaly*
                      $_SERVER['REQUEST_METHOD'], 
                      'https', 
                      false))
        ->withFakeHost(true) //*Do overwrite/not use users host header
        //...or...
        ->withFakeHeader('X-Forwarded-Host')
    ;
    
	$proxy->handle(true);

Internally the proxy ignores the bounce-detection silently to fallback to any localhost scripts. You can use it before/without handling the HTTP-Forwarding, e.g. to perform a (test-)request on the same host.

<?php
if(!$proxy->bounce()){	
 	$proxy = (new Proxy('blue',
                      $_SERVER['REQUEST_URI'],
                      'blue.example.com',  //target host
                      'example.com',  //set the host header on the target script
                      $_SERVER['REQUEST_METHOD'], 
                      'https', 
                      true))
  ->handle(true);                    
}

Cache

Built in cache feature:

composer require doctrine/cache
$proxy->withCacheDir(string $dir = null, int $ttl= 1800, bool $force=true)

About

php proxy scripts

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages

Morty Proxy This is a proxified and sanitized view of the page, visit original site.