How do I have both directory listing and a html page served below eathother

1. The problem I’m having:

I have just set up a server with file listing on. Now I want to both list files and show the index.html file below eathother, like how the github file browser does it with markdown. How would I set this up? Is it even possible using caddy?

2. Error messages and/or full log output:

journalctl -u caddy --no-pager | less +G returns a full log off… nothing! But I also think this is not relevant for this question. I have filled this out with all output, please don’t ask for log output anymore, there are no errors in there.


3. Caddy version:

v2.7.4 h1:J8nisjdOxnYHXlorUKXY75Gr6iBfudfoGhrJ8t7/flI=

4. How I installed and ran Caddy:

Using the instructions for apt here.

a. System environment:

Raspberrypi 4

b. Command:

caddy is enabled as systemctl service.

systemctl reload caddy # to reload the config
systemctl start caddy # to start caddy

c. Service/unit/compose file:

I don’t know, just the default.

d. My complete Caddy config:

root * /home/vosje/https/httpssite
file_server browse

5. Links to relevant resources:

I currently solved this by editing the directory listing template, and the result is in this gist. It checks if a header.html file is found in the current directory, and uses JQuery to display it above the listing. It does the same for readme.html, but below the listing. A guide for setting this up is in the comments of the gist.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.