-
Notifications
You must be signed in to change notification settings - Fork 43
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
Wrong baseurl when running behind proxy #89
Comments
That value should be statically set by the user instead of automatically trying to figure out the right one. Or it's better to just use relative URI and stop comparing it to the domain. 🤔 Will figure something out. |
Please check if this modified code works on your setup. $baseurl = "/";
$Website->assign("baseurl", $baseurl);
// Current URL
$currentUrl = $baseurl . ltrim($_SERVER["REQUEST_URI"], "/");
$Website->assign("currentUrl", $currentUrl);
// Webroot
$basepath = $settings["url"]["base"];
if(strlen($basepath) > 0 && !preg_match("/\/$/", $basepath)) {
$basepath .= "/";
}
$webroot = $baseurl . ltrim($basepath, "/");
$Website->assign("webroot", $webroot); I also removed "base url" and "force the use of HTTPS" parts from this file as well. |
Yes this fixes errors. Just in case here is diff that i used:
|
I have setup where php4dvd is running behing proxy. Looks like baseurl is set according to last hop so all assets (js, css, etc) are loaded from wrong URL. If i'm reading code correctly problem is here:
https://github.com/jreklund/php4dvd/blob/master/common.inc.php#L77
This should first check if header
HTTP_X_FORWARDED_HOST
is set and use that and only fallback to$_SERVER["HTTP_HOST"]
if header is not set.The text was updated successfully, but these errors were encountered: