Our great sponsors
-
httpie
🥧 HTTPie CLI — modern, user-friendly command-line HTTP client for the API era. JSON support, colors, sessions, downloads, plugins & more. (by httpie)
-
WorkOS
The modern identity platform for B2B SaaS. The APIs are flexible and easy-to-use, supporting authentication, user identity, and complex enterprise features like SSO and SCIM provisioning.
the code should be pretty straighforward. for every request to /proxy/{path}, it would make a request to httpbin.org/{path} with the same HTTP method. you could try requesting the new endpoint using different methods to see it in effect. here I used HTTPie to test the endpoint:
use GuzzleHttp\Client as HttpClient; Route::any('/proxy/{path}', function(Request $req, $path) { $client = new HttpClient([ 'base_uri' => 'https://httpbin.org' ]); return $client->request($req->method(), $path); });