xhgui and relative paths
Hi all,
I tried setup xhgui at our main host at additional location /xhgui.
I tried a lot of configurations with nginx, but I'm able only to load main page. All links inside page (to js, css, as well as links to menu items) are relative and pointed to absolute website root (/js/...), instead of relative current root (/xhgui/js...). Do you have any special config option to set base path for xhgui (like HTTP_BASE = http://oursite.com/xhgui/) ? Or maybe you can suggest another solution for that?
Otherwise that feature could be very useful.
Thanks!
Currently there isn't a way to configure a base path. Adding one sounds like a good idea though.
I was able to setup XHGUI in a virtual directory by simple changing the rewrite rules in web.config.
The only change is to remove the leading slash in /index, and add
<configuration>
<system.webServer>
<rewrite>
<rules>
<clear/>
<rule name="rule 1n" stopProcessing="true">
<match url="^" />
<action type="Rewrite" url="index.php" appendQueryString="true" />
<conditions>
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
</conditions>
</rule>
</rules>
</rewrite>
<handlers configSource="handlers.config" />
</system.webServer>
</configuration>
Hi @markstory,
I also wanted to commit my changes related to saving not only relative urls, but full/absolute urls. Example: /contact-us path will be saved as example.com/contact-us.
I use xhgui on multi-website project and I need full urls on xhgui profiling. Should I make this feature enable/diaable via config?
I ran into the same problem and tried to work around it with Alias/Rewrite before discovering this issue here.
I changed a few lines of code and now it works for me. I am not sure, if this is the best practice, but the usage of the 'static' function inside Twig-Templates seems pretty limited, so i guess it won't break stuff.
I can create a pull request for it, but maybe it is better to discuss this first.
src/Xhgui/Twig/Extension.php:73
public function staticUrl($url)
{
$rootUri = $this->_app->request()->getRootUri();
// get URL part prepending index.php
$indexPos = strpos($rootUri, 'index.php');
if ( $indexPos > 0 ) {
return substr($rootUri,0,$indexPos) . $url;
} else {
return $rootUri . '/' . $url;
}
}
@noreabu That code seems pretty reasonable to me.
Ok, i will create a pull request later.
Awesome!
My Mailserver is currently "on vacation" so it will take some more time to retrieve my github pw to this machine... but don't worry the pull request will be there shortly after :)