Comments (3)
Yep, this is a known issue. I couldn't find any good way to fix that. Any idea?
from debugbar.
I dug into this a bit more and found out that there was an issue that talked about inlining the icons themselves and/or using a CDN for the font, but neither actually happened. In my opinion if they have an inline mode then they need to inline the icons.
All my code lives above the html root folder including my vendor folder so I have to use inline. The issue I have now is that the 404s are causing a conflict with a custom middleware I wrote that logs 404s and locks out IP's that appear to be route sniffing.
All that said the only thing I can think of as a viable solution is to add some logic to this middleware that does something for each needed file that does something like, IF a route callback isn't defined for the route "/fonts/fontawesome-webfont.woff2?v=4.7.0" THEN go grab the file out of the correct vendor location and return that as the response.
That would pass through the font files needed and allow the bar to display properly. That same logic could also potentially be applied to the non-inline version as well. It would also allow a defined route to override that if needed. Most importantly though it would take care of the 404's.
from debugbar.
This issue can be addressed by using the new renderOptions
feature introduced by Pull Request #12. Using the example in the readme and modifying the following code as needed you can create routes for the assets. This will solve 404 issues without the need to use the broken inline feature.
$srcPath = PATH_TO_YOUR_SRC_FOLDER;
$DebugBarResourcesDirPath = $srcPath.'vendor/maximebf/debugbar/src/DebugBar/Resources/';
if( is_dir($DebugBarResourcesDirPath) ) {
$DebugbarResourcesIterator = new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($DebugBarResourcesDirPath));
$DebugBarPaths = array_filter(iterator_to_array($DebugbarResourcesIterator), function($file) {
return $file->isFile();
});
foreach (array_keys($DebugBarPaths) as $DebugBarPath ) {
$filePath = "/".str_replace($srcPath,"",$DebugBarPath);
$r->addRoute(['GET', 'OPTIONS'], $filePath, function ($request) {
$path = $srcPath.$request->getUri()->getPath();
$mime_type = mime_content_type($path) ?: 'application/octet-stream';
$file_size = filesize($path);
header("Content-Type: $mime_type");
header("Content-Length: $file_size");
$fh = fopen($path, 'rb');
fpassthru($fh);
fclose($fh);
});
}
}
from debugbar.
Related Issues (9)
- Question: use with relayphp/Relay.Relay HOT 2
- Logging Messages HOT 2
- `middlewares/utils` v4 support needed HOT 1
- Option to embed JS and CSS inline HOT 1
- Add an option to insert the assets inline HOT 1
- Allow running from arbitrary server locations (i.e. not server-root). HOT 2
- Add info that vendor must be accessible via HTTP HOT 4
- Adding to Slim Framework HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from debugbar.