question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

extension creates 404 requests for images in css files with relative path

See original GitHub issue

This extension creates a lot of 404 requests on web servers which uses background-images in CSS files with an relative path.

e.g. i have following files: /test.html /sub/test.html /css/style.css /css/images/background.png

Content of /test.html (for the test.html in sub directory href=“…/css/style.css”

<!DOCTYPE html>
<html>
<head>
    <link rel="stylesheet" type="text/css" href="css/style.css">
    <title>test in root</title>
</head>
<body>
<div class="my-class">
    this should have a background
</div>
</body>
</html>

content of /css/style.css

.my-class {
    height:500px;
    width: 500px;
    display: block;
    background: url("images/background.png") repeat scroll 0 0 green;
}

e.g. if i open/test.html

without dark reader enabled: image

with dark reader enabled: image

the background image is requested 3 times! http://localhost/test/image-test/css/images/background.png (correct path from the html code) http://localhost/test/image-test/css/images/background.png (by the index.js code from the extension) http://localhost/test/image-test/images/background.png => 404 html error

Relative URLs are allowed, and are relative to the URL of the stylesheet (not to the URL of the web page).

CSS Url Syntax

Same issue of course also for html requests which are located in sub directories e.g. /sub/test.html.

Issue Analytics

  • State:open
  • Created 4 years ago
  • Reactions:6
  • Comments:18 (8 by maintainers)

github_iconTop GitHub Comments

1reaction
bartektrybalacommented, Jun 2, 2022

In Dark Reader settings you can choose theme generation mode other than Dynamic but every other isn’t cool. You can also write your custom theme mode with click on Static theme generation mode.

0reactions
stefan6419846commented, Oct 13, 2022

I just stumbled upon the same issue after seeing seemingly random 404 entries in my log file when using background-image: url('../../images/image.png') in my CSS files.

Read more comments on GitHub >

github_iconTop Results From Across the Web

html - Image not found altough right relative path is specified
The path is relative and to my information correct, but I always get a 404 error. Found no solution after browsing endlessly.
Read more >
Host and deploy ASP.NET Core Blazor WebAssembly
Learn how to host and deploy Blazor WebAssembly using ASP.NET Core, Content Delivery Networks (CDN), file servers, and GitHub Pages.
Read more >
Problems with using relative path names [#13148] | Drupal.org
Looking at my site's logs, there seem to be several problems that are caused by Drupal's use of relative path names. If Drupal...
Read more >
Failed to Load Resource: The Server Responded With a ...
An invalid relative path for a resource in your website or application causes an ... you'll get an error when the server tries...
Read more >
HTML and Static Assets - Vue CLI
If the URL starts with . , it's interpreted as a relative module request and resolved based on the folder structure on your...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found