-
Notifications
You must be signed in to change notification settings - Fork 291
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
PROJECT_URI should be configurable #330
Comments
@PascalTurbo: Due to the lack of details, I am not quite sure, if one of the cases fits to your problem. I suggest the following update of # Determine PROJECT_BASEURI
# in some environments $_SERVER["DOCUMENT_ROOT"] . PROJECT_BASEURI != $_SERVER["SCRIPT_FILENAME"]
# PROJECT_BASEURI has to be calculated using $_SERVER["SCRIPT_FILENAME"] and $_SERVER["SCRIPT_NAME"]
# finde start of shared postfix of $_SERVER["SCRIPT_FILENAME"] and $_SERVER["SCRIPT_NAME"]
$i = 1;
while ($i <= min(strlen($_SERVER["SCRIPT_FILENAME"]),strlen($_SERVER["SCRIPT_NAME"]))
&& substr($_SERVER["SCRIPT_FILENAME"], -$i, 1) == substr($_SERVER["SCRIPT_NAME"], -$i, 1)) {
$i++;
}
$sScript = substr($_SERVER["SCRIPT_FILENAME"], -($i-1), $i);
unset($i);
$sScript = substr($sScript,strpos($sScript,DIRECTORY_SEPARATOR)); # remove path segement stubs
$sScript = substr($_SERVER["REQUEST_URI"],0,strrpos($_SERVER["REQUEST_URI"],preg_replace("/index\.php$/","",$sScript))) . $sScript; # get folder of the script (using preg_replace to remove automatically added index.php or similar)
$sDirName = str_replace("\\", "/", dirname($sScript)); # fix windows backslashes It is clear, that this causes an calculation overhead, which would be an advantage of the parameter configuration. |
Honestly i think it's important to try to not automatically detect anything if you have more complex needs. My understanding is that you're looking for a way to support the idea that the proxy base url is different than the origin url. To properly support this, it's not enough to just set the relevant $_SERVER variables. Every XML response for example would have incorrect urls. |
I'm closing this ticket because it's been a while since the last comment. If this is indeed still an issue, feel free to comment here so we can continue discussing. |
Hello, I have a similar problem (upgrading to 0.7.0 from 0.4.x): I have Alias /cal/ /somedir/baikal/html/ in my httpd.conf (/somedir/baikal/ being outside the DocumentRoot, I don't want to put the entire Baikal tree in my DocumentRoot). The main page (https://mydom.ain/cal/) as well as the admin page (https://mydom.ain/cal/admin/) works, but /cal/dav.php complains: Requested uri (/cal/dav.php) is out of base uri (/al/html/dav.php/) It seems the base uri guessing logic is wrong, but only for dav.php, and not for index.php nor admin/index.php. |
@ByteHamster: added comment to #928 I have also found (trying to run Baikal inside container with reverse-proxy in front of it), that Baikal even adds Having the PROJECT_URI (as seen from the outside world) configurable instead of incorrectly trying to guess it would help. Also, the |
I fought a hard fight installing Baikal in my environment. After some investigation I found, that the base-url is calculated. This is a very nice behavior if you use baikal directly on a vhost - but unusable if you have a load balancer in front of it - so do I. There has been multiple problems:
I think it should be possible to configure the base url in the global configuration file. If it's not configured the current behaviour would fitt.
The text was updated successfully, but these errors were encountered: