-
Notifications
You must be signed in to change notification settings - Fork 8
/
example.php
25 lines (20 loc) · 979 Bytes
/
example.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
<?php
use App\Helpers\ProxyHelperFacade;
use Illuminate\Http\Request;
/*
|--------------------------------------------------------------------------
| API Routes
|--------------------------------------------------------------------------
|
| Here is where you can register API routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| is assigned the "api" middleware group. Enjoy building your API!
|
*/
Route::match(['get', 'post', 'head', 'patch', 'put', 'delete'] , 'proxy/{slug}', function(Request $request){
return ProxyHelperFacade::CreateProxy($request)
->withHeaders(['x-proxy' => 'laravel'])
->withToken('eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1bmlxdWVfbmFtZSI6Imp1YW5AZ21haWwuY29tIiwic2oxNTkwMTkyNTE1fQ.db5AZuw3eSAHqjdaRn9AZX8LPbNAxPmuO8BZlEmIGk4')
->preserveQuery(true)
->toHost('http://dockerserver.test','api/proxy');
})->where('slug', '([A-Za-z0-9\-\/]+)');