Use of _SERVER["REQUEST_URI"] in email templates can cause problems in server farm environment
- Status
- Pending
- Subject
- Use of _SERVER["REQUEST_URI"] in email templates can cause problems in server farm environment
- Version
- 1.9.x
- Category
- Error
- Feature
- All / Undefined
- Submitted by
- PaytonByrd
- Lastmod by
- PaytonByrd
- Rating
- Description
This block of code is not very well behaved, and it appears in a lot of places:
// Now check if the user should be notified by email
$foo = parse_url($_SERVER["REQUEST_URI"]);
$machine = $tikilib->httpPrefix(). dirname($foo["path"]);
$machine = preg_replace("!/$!", "", $machine); // just incase
$smarty->assign('mail_machine', $machine);In my test environment I'm hitting the website via the LAN machine name and not the public URL. Setting $foo from _SERVER["REQUEST_URI"] is causing the URL to use the LAN machine name and not the fully qualified name.
Technically this will cause the email to use the host name of whatever the user was hitting, but that would be bad in a server farm where you may need to use a scheme such as www1, www2, www3, etc as the user would always go back to that server instead of letting the load balancer figure it out.
I could see this being a problem anywhere the code is using _SERVER["SERVER_NAME"] as well.
To me the root problem here is that the templates are depending on two different sources for the same data (the hostname portion of the URL).
- Solution
- Use the configured value of the HTTP server name from the login configuration instead.
- Importance
- 3
- Priority
- 15
- Demonstrate Bug on Tiki 19+
-
This bug has been demonstrated on show2.tiki.org
Please demonstrate your bug on show2.tiki.org
Show.tiki.org is not configured properlyThe public/private keys configured to connect to show2.tiki.org were not accepted. Please make sure you are using RSA keys. Thanks.
- Demonstrate Bug (older Tiki versions)
-
This bug has been demonstrated on show.tikiwiki.org
Please demonstrate your bug on show.tikiwiki.org
Show.tiki.org is not configured properlyThe public/private keys configured to connect to show.tikiwiki.org were not accepted. Please make sure you are using RSA keys. Thanks.
- Ticket ID
- 1555
- Created
- Monday 11 February, 2008 18:57:13 UTC
by Unknown - LastModif
- Monday 11 February, 2008 20:01:31 UTC