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

Some urls / domains get redirected #137

Open
Collusion opened this issue Feb 28, 2018 · 2 comments
Open

Some urls / domains get redirected #137

Collusion opened this issue Feb 28, 2018 · 2 comments

Comments

@Collusion
Copy link

Example domain:
http://superbestaudiofriends.org/index.php

If I try to open any of the subforums via the proxified page, I get back to the front page ( the url above ). I've tried to debug this myself, but haven't had any luck.

Example:
http://superbestaudiofriends.org/index.php?threads/what-are-you-listening-to-right-now.6/page-254

At ProxifyPlugin.php in function onBeforeRequest(ProxyEvent $event):

$request = $event['request'];

If I dump the $request object, I get the following output:

object(Proxy\Http\Request)#18 (10) {
["method":"Proxy\Http\Request":private]=>
string(3) "GET"
["url":"Proxy\Http\Request":private]=>
string(42) "http://superbestaudiofriends.org/index.php"
["protocol_version":"Proxy\Http\Request":private]=>
string(3) "1.1"
["params"]=>
object(Proxy\Http\ParamStore)#19 (2) {
["data":protected]=>
array(0) {
}
["case_sensitive":protected]=>
bool(false)
}
....

So for some reason, unknown to me, the url changes on the way. This is so far the only domain I've encountered this issue with, but as always, there are bound to be more...

@Collusion Collusion changed the title Some urls / domains do not load as expected Some urls / domains get redirected Mar 1, 2018
@Athlon1600
Copy link
Owner

The issue is with the way we are parsing that forum URL:

use Proxy\Http\Request;

echo '<pre>';

$url = "http://superbestaudiofriends.org/index.php?threads/what-are-you-listening-to-right-now.6/page-254";
var_dump($url);

$request = new Request('GET', 'url.com');
$request->setUrl($url);

var_dump($request->getUri());

which outputs:

string(97) "http://superbestaudiofriends.org/index.php?threads/what-are-you-listening-to-right-now.6/page-254"
string(102) "http://superbestaudiofriends.org/index.php?threads%2Fwhat-are-you-listening-to-right-now_6%2Fpage-254="

The http_build_query function from here:
https://github.com/Athlon1600/php-proxy/blob/master/src/Http/Request.php#L172

escapes all the slashes and dots from this portion of that URL:

forums/tales-from-the-bully-pulpit.2/

and transforms it into something that super-best-audio-friends server now treats as a whole different URL. The solution is not as easy as I thought it was going to be. Will look more into it this weekend.

@Athlon1600 Athlon1600 reopened this Mar 4, 2018
@Athlon1600 Athlon1600 transferred this issue from Athlon1600/php-proxy-app Jun 16, 2020
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

2 participants