Bug #23
closed
Links broken on sub-folders due to relative paths
Added by Chris Buechler over 15 years ago.
Updated almost 12 years ago.
Description
At a screen of an installed package, like freeswitch, which uses a separate directory, the upper left logo of pfsense does not go to home.
We used to make all the paths absolute, problem is if the paths are defined like that, when you access through a reverse proxy it breaks everything. Some people use a reverse proxy to access numerous systems, with URLs like https://example.com/firewall1/ and /firewall2/ etc. and changing it back would break that.
Definitely something we need a solution for, though I'm not sure what the solution should be. Maybe we break the reverse proxy ability with sub-directories since that's a very small minority to fix it for the majority. As long as it doesn't break the ability to access the web interface over a SSH tunnel, which is frequently done.
There could be something that calculates a relative path that goes to the web site's root directory and stores it in a global variable. This variable could be prepended before anything that needs an absolute path. For example, if you need /index.php but are at /some/path/mypage.php, you could have a variable like $root_path be calculated to be "../../", since the current path is two levels deep. To link to /index.php, you could use "{$root_path}index.php".
Issue: upper left logo of pfsense does not go to home when package files are not in the root folder. Example /usr/local/www/snort/.
Fix: adjust link path in fbegin.inc.
FROM:
href="index.php"
TO:
href="/index.php"
All packages no mater the level depth will now point to the right index.php in pfsense.
I dont know what this will do to reverse proxy users....
Here's a good way to come up with a prefix, I think:
$s = explode('?', $_SERVER['REQUEST_URI']);
$url_prefix = str_repeat('../', max(substr_count(preg_replace('/\/+/', '/', $s[0]), '/') - 1, 0));
- Status changed from New to Closed
We have been prefixing the paths with / for a while now on 2.1 (and earlier?)
Also available in: Atom
PDF