Browse Source

Create example.php

master
juanal98 4 years ago
committed by GitHub
parent
commit
b52ecc1653
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 25
      example.php

25
example.php

@ -0,0 +1,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\-\/]+)');
Loading…
Cancel
Save