Page MenuHomePhabricator

tools-static webserver shows directory listing instead of the index file
Open, LowPublic

Description

Lighttpd has configured index file names (index.php, index.html, index.htm) and those work correctly. However, if I go to the exact same folder using the tools-static server, the index file is not used, and a directory listing is displayed instead.

Cf. https://mormegil.toolforge.org/propertylinker/volby/ and https://tools-static.wmflabs.org/mormegil/propertylinker/volby/ with the index available at the explicit https://tools-static.wmflabs.org/mormegil/propertylinker/volby/index.htm instead.

I would expect the tools-static webserver to

  1. have directory listing disabled (and, yes, to show 403 Forbidden for requests for a directory with no index file, just like the non-static server does), and (I was explained the reasoning on IRC, and in fact, it makes sense to have directory listing enabled on the static server, as there is no alternative for it when offering e.g. IRC logs)
  2. have the index file names configuration identical to the non-static server (possibly with the obvious exception of index.php which wouldn’t work on the static server, but the users shouldn’t have PHP files in there, anyway, so it should not matter).

Event Timeline

taavi triaged this task as Low priority.Jun 5 2024, 1:29 PM
taavi subscribed.

I'm curious about the use case here - tools-static is mostly intended for hosting static assets/images/etc, not full websites accessed by users.

Well, what difference is there between “static assets” and “full websites”? Back in my day, all websites were just static assets (…kids these days…). :-D

The use case is linked above: a set of static HTML files (machine-generated, but plain static HTML) in a directory, available under the relevant IDs (the files contain the relevant links for individual political parties in the Czech Republic, linked using https://www.wikidata.org/wiki/Property:P11031); and next to them, there is an index file containing their list in a human-readable format, so that you can go and find the relevant ID easily.

On IRC, I have later learned that this is just a small difference between the default configuration of lighttpd used for the PHP server, and the default configuration of nginx used for the static server: lighthttpd uses index.php index.html index.htm, while nginx uses just index.html. So had I named the index file index.html instead of index.htm, it would work correctly.

So… this is really a low-impact request, basically just saying “there is a surprising difference in configuration between lighttpd and nginx, which probably should be corrected and index.htm added to the nginx configuration to unify them”. Nothing critical.