Giter Club home page Giter Club logo

Comments (12)

parallels999 avatar parallels999 commented on May 27, 2024 1

my local server runs on port 8900 and I installed laravel in /testl

The normal thing is to configure a virtual host to avoid these kind problems

<VirtualHost *:8900>
  DocumentRoot "C:\laravel\testl\public"
  ServerName laravel.localhost
  Header set Access-Control-Allow-Credential true
  <Directory "C:\laravel\testl\public">
    Options Indexes FollowSymLinks
    AllowOverride All
    Require all granted
  </Directory>
</VirtualHost>

So, your url is like http://laravel.localhost
laradock/laradock/apache2/sites/sample.conf.example

from laravel-debugbar.

serge-kilimoff avatar serge-kilimoff commented on May 27, 2024 1

Same problem from me, when I upgrade to Laravel 11.

The "normal thing" with a virtual host is not a solution, when you have (per exemple) multiples apps laravel on the same server (like testing git branchs individually from a test server) .
And Laravel can be deploy behind a subfolder.

from laravel-debugbar.

barryvdh avatar barryvdh commented on May 27, 2024 1

Can you try dev-master?

from laravel-debugbar.

erikn69 avatar erikn69 commented on May 27, 2024

Maybe related to #1562
On this case i think #1555 is a better option

from laravel-debugbar.

alexmocanu avatar alexmocanu commented on May 27, 2024

my local server runs on port 8900 and I installed laravel in /testl

The normal thing is to configure a virtual host to avoid these kind problems

<VirtualHost *:8900>
  DocumentRoot "C:\laravel\testl\public"
  ServerName laravel.localhost
  Header set Access-Control-Allow-Credential true
  <Directory "C:\laravel\testl\public">
    Options Indexes FollowSymLinks
    AllowOverride All
    Require all granted
  </Directory>
</VirtualHost>

So, your url is like http://laravel.localhost laradock/laradock/apache2/sites/sample.conf.example

I agree... using a vhost and pointing some fake domain to it in the /etc/hosts file would have been easy, but due to some circumstances outside my control, my current setup is locked down and I can't do that.

For now I downgraded to version 3.10, which loads the debug bar's assets correctly regardless of url.

from laravel-debugbar.

adriweb avatar adriweb commented on May 27, 2024

Same issue here still on Laravel 10.x (latest 10.x so far). It seems to be due to #1562 which forces relative URLs somehow? I'm not sure.

FWIW, my laravel app/website is on a subdirectory on the apache server, and APP_URL is correctly set in the .env file.

In fact, the routes get correctly set up for the proper subdirectory if I try going to the javascript one manually in the browser, for instance, but it's the injected html to load js/css that's missing the app_url part.
For now, I've just forced the usage of the 3.10.6 release.

from laravel-debugbar.

alexmocanu avatar alexmocanu commented on May 27, 2024

Something like this in JavascriptRenderer.php should solve the issue:

$cssRoute = route('debugbar.assets.css', [
    'v' => $this->getModifiedTime('css'),
    'theme' => config('debugbar.theme', 'auto'),
]);

$jsRoute = route('debugbar.assets.js', [
    'v' => $this->getModifiedTime('js')
]);

$cssRoute = parse_url($cssRoute, PHP_URL_PATH);
$jsRoute = parse_url($jsRoute, PHP_URL_PATH);

The issue started when someone requested that the domain name part be removed in addition to the http/https part.

I think it's better to just build the complete url and remove the http/https + domain parts, keeping the whole relative path. This should make it work regardless if laravel is hosted in some subdirectory or not. Setting $absolute to false in the "route" helper cuts too deep - it removes the whole APP_URL string.

from laravel-debugbar.

sakihl avatar sakihl commented on May 27, 2024

Thanks @alexmocanu
I was just about to try to copy the change in #1555 when I realised that my source file was a later version including #1562 and therefore the code didn't match. I have tried your suggested change to JavascriptRenderer.php instead and it seems to have fixed the problem. My console errors have disappeared and the debugbar is showing. I hope your suggestion has no unwanted side-effects and can become a fix.

from laravel-debugbar.

erikn69 avatar erikn69 commented on May 27, 2024

parse_url($cssRoute, PHP_URL_PATH); cuts the query part, #1555 is a better option

from laravel-debugbar.

swartjie avatar swartjie commented on May 27, 2024

Has this been patched?
It seems to still happen on the installation I did about 5 hours ago...

from laravel-debugbar.

swartjie avatar swartjie commented on May 27, 2024

@barryvdh working like a charm. Thank you!

from laravel-debugbar.

nafiesl avatar nafiesl commented on May 27, 2024

@barryvdh dev-master works for me as well. (laravel 11)

from laravel-debugbar.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.