Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Passes on path #60

Open
czycha opened this issue Oct 23, 2018 · 1 comment
Open

Passes on path #60

czycha opened this issue Oct 23, 2018 · 1 comment

Comments

@czycha
Copy link

czycha commented Oct 23, 2018

Let's say I have this online at http://example.com/proxy and I'm using this to forward to http://api.com/api. When I make a JavaScript fetch request to http://example.com/proxy, the proxy ultimately requests http://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.

@czycha
Copy link
Author

czycha commented Oct 26, 2018

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant