Project

General

Profile

[Solved] dir-listing.external-css problem

Added by Jack777 about 1 month ago

I cannot get the directory listing injections work.

I can browse the file and it appears in browser ok so the file settings should be ok. Here is the file:

-rwxr-xr-x 1 www-data www-data 1.1K 2024-11-23 18:01 custom-dirlisting.css

The content of the file is the user-contributed Sample CSS copied from [[https://redmine.lighttpd.net/projects/lighttpd/wiki/Mod_dirlisting]] .

lighttpd.conf has the following line:

dir-listing.external-css = "/var/www/html/css/custom-dirlisting.css" 

What I am doing wrong ?


Replies (6)

RE: dir-listing.external-css problem - Added by Jack777 about 1 month ago

lighttpd/1.4.69 (ssl) - a light and fast webserver

RE: dir-listing.external-css problem - Added by gstrauss about 1 month ago

You activate dir-listing only for url-paths matching ^/t/

$HTTP["url"] =~ "^/t/" {
     dir-listing.activate = "enable" 
     dir-listing.show-size = "enable" 
}

RE: dir-listing.external-css problem - Added by gstrauss about 1 month ago

Make sure you clear your browser cache. Try a different browser, or try on a different machine.

I recommend testing with a command line tool such as curl and looking at the HTML to verify that the HTML contains the reference to the external CSS file.

RE: dir-listing.external-css problem - Added by Jack777 about 1 month ago

Thanks for the reply.
The problem was <link> tag's path in 'href' attribue it must be relative to the location of the page. Now it is as follows and everything works ok.

<link rel="stylesheet" type="text/css" href="../css/custom-dir.css">

RE: dir-listing.external-css problem - Added by gstrauss about 1 month ago

Yes. dir-listing.external-css is a url-path, and can be root-relative if the .css is on the same site, or can be a different URL. As documented on mod_dirlisting

dir-listing.external-css

URL to an external css stylesheet for the directory listing.

Wrong: dir-listing.external-css = "/var/www/html/css/custom-dirlisting.css"
Correct: dir-listing.external-css = "/css/custom-dirlisting.css"
Correct: dir-listing.external-css = "https://example.com/css/custom-dirlisting.css"

RE: [Solved] dir-listing.external-css problem - Added by Jack777 about 1 month ago

Tested. This is correct.
Thank you.

    (1-6/6)