Skip to content

Allow index files when checking a folder #542

@dkarlovi

Description

@dkarlovi

(note: this was previously discussed in #452 (comment))

When deploying HTML files to some common platforms like Netlify or Gitlab Pages (or even on a typical Apache HTTP environment), you can rely on the platform to use an "index file", namely, for an URL like https://example.com/foo, it will serve ./public/foo/index.html if such a file exists.

Typically, a document called index.html will be served when a directory is requested without a file name being specified. For example, if DocumentRoot is set to /var/www/html and a request is made for http://www.example.com/work/, the file /var/www/html/work/index.html will be served to the client.

This means that, the heuristic should look like this:

  1. is the "index file" feature enabled?
  2. if so, does the URL naturally resolve to a folder?
  3. if so, does the folder contain a file called index.html (or index.htm, maybe allow passing a list when enabling the feature)
  4. if so, the URL is actually valid

The feature could be enabled as lychee --allow-index-file index.html (where the name is used in 3)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No fields configured for Feature.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions