Please upgrade here. These earlier versions are no longer being updated and have security issues.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.
Posting comment causes new page to be loaded with referer to a LAN IP
Consider:
http://EXAMPLE.COM/MYFORUM/index.php?p=/discussion/12/test-thread
Posting on that thread leads the browser to reload a link like:
http://INTERNAL-IP-ADDRESS/MYFORUM/index.php?p=/discussion/comment/39#Comment_39
This will lead to failure in viewing the new post unless we're on the local network and having the browser bypassing the local proxy for local addresses.
However, the post is actually registered, and if I swap the INTERNAL-IP-ADDRESS with my EXAMPLE.COM the comment is actually there.
So the problem here seems something like a post-posting issue of which-page-shall-I-(the-forum)-display as the refresh page?
So is there a way to make the forum ALWAYS ignore the host machine internal address and instead always use the domain one provided by the gateway machine when it constructs its request links?
http://EXAMPLE.COM/MYFORUM/index.php?p=/discussion/12/test-thread
Posting on that thread leads the browser to reload a link like:
http://INTERNAL-IP-ADDRESS/MYFORUM/index.php?p=/discussion/comment/39#Comment_39
This will lead to failure in viewing the new post unless we're on the local network and having the browser bypassing the local proxy for local addresses.
However, the post is actually registered, and if I swap the INTERNAL-IP-ADDRESS with my EXAMPLE.COM the comment is actually there.
So the problem here seems something like a post-posting issue of which-page-shall-I-(the-forum)-display as the refresh page?
So is there a way to make the forum ALWAYS ignore the host machine internal address and instead always use the domain one provided by the gateway machine when it constructs its request links?
Tagged:
0
Best Answer
-
Todd Vanilla StaffThe site tries to get your host from the following
$_SERVER
variables: HTTP_HOST then SERVER_NAME.
You can try one of the following:
1. If someone has the ability in your organization to configure your server properly then you're good to go.
2. Try using your .htaccess file to set the appropriate $_SERVER variable. See this or google around a little bit.
3. Write a plugin that manually sets the host to the appropriate value:public function Base_AfterAnalyzeRequest_Handler($Sender, $Args) {
Gdn::Request()->RequestHost('EXAMPLE.COM');
}0
Answers
$_SERVER
variables: HTTP_HOST then SERVER_NAME.You can try one of the following:
1. If someone has the ability in your organization to configure your server properly then you're good to go.
2. Try using your .htaccess file to set the appropriate $_SERVER variable. See this or google around a little bit.
3. Write a plugin that manually sets the host to the appropriate value:
// UGLY HACK -- below //$this->RequestHost(isset($_SERVER['HTTP_HOST']) ? ArrayValue('HTTP_HOST',$_SERVER) : ArrayValue('SERVER_NAME',$_SERVER)); $this->RequestHost(ArrayValue('SERVER_NAME',$_SERVER));
So that it only gets the SERVER_NAME when it asks for the host. I would go for option 3 if only my php knowledge weren't so rudimentary.
Vanilla Forums COO [GitHub, Twitter, About.me]