https://github.com/frdl/proxy
php proxy scripts
https://github.com/frdl/proxy
Last synced: 5 months ago
JSON representation
php proxy scripts
- Host: GitHub
- URL: https://github.com/frdl/proxy
- Owner: frdl
- License: mit
- Created: 2020-04-16T21:04:48.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2024-09-01T20:23:00.000Z (almost 2 years ago)
- Last Synced: 2024-11-03T22:08:38.638Z (over 1 year ago)
- Language: PHP
- Homepage: https://webfan.de/install/
- Size: 90.8 KB
- Stars: 1
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# frdl/proxy
Simple Php Proxy based on Guzzle.
## Installation
Use Composer...
````
composer require frdl/proxy
````
...or the [Webfan Installer](https://frdl.webfan.de/install/php/) if you would like to build a larger project.
## Usage
````php
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
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
````
````php
$proxy->withCacheDir(string $dir = null, int $ttl= 1800, bool $force=true)
````