Skip to content

Regex used in JavascriptRenderer.php overrides/negates route_domain parameter #1637

Open
@chrischi1989

Description

@chrischi1989

Hi there

I need to load the Debugbar from a sub domain because that's where my Laravel instance is running and my system on my top-level domain is querying Laravel via Guzzle. Maybe it sound kinda weird but that's how it is.

I set the route_domain parameter in the debugbar.php and cleared & cached the config for Laravel. After reloading my system I saw that the injected HTML still tries to load the debugbar assets from my top level domain.

So I did some testing and debugging and found out that the Regex used in these lines in the JavascriptRenderer.php is removing the domain completely, resulting in $cssRoute only be filled with /_debugbar/assets/[...] and NOT including the route_domain given via the config file:

$cssRoute = preg_replace('/\Ahttps?:\/\/[^\/]+/', '', route('debugbar.assets.css', [

$jsRoute = preg_replace('/\Ahttps?:\/\/[^\/]+/', '', route('debugbar.assets.js', [

Tests & Debugging

I did a quick test, setting some.domain as the route_domain parameter. Then I did some tinkering in the JavascriptRenderer with the old regex and watched Xdebug while refreshing my system. These are the results:

grafik

I also did some tests with regex101.com

Current regex

grafik

Old regex (don't know when this was changed)

grafik

As you can see the current used regex matches the whole domain and therefor the preg_replace will remove it entirely from the string.

I don't think this is intended behavior and it would be cool if you guys could take a look at this.

Greetings

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions