Open czycha opened 5 years ago
I ended up filtering it, overriding the URI that the class passes in:
use GuzzleHttp\Psr7\Uri;
$proxy->filter(function ($request, $response, $next) use ($url) {
$request = $request->withUri(new Uri($url));
$response = $next($request, $response);
return $response;
});
I still think that this is non-standard behavior—it should go to the URL provided by the to
function and not modify it to this extent.
Let's say I have this online at
http://example.com/proxy
and I'm using this to forward tohttp://api.com/api
. When I make a JavaScript fetch request tohttp://example.com/proxy
, the proxy ultimately requestshttp://api.com/api/proxy
, resulting in a 404. Is there some sort of filtering that I should be doing to prevent this path from being appended?I'm not doing much beyond the example in the readme.