I’m running into a limitation with IPFS regarding directory listing.
Unlike traditional web servers such as Nginx or Apache (with autoindex on), IPFS does not provide a built-in way to list directory contents on the server side.
In my case, the “Media” section of my index.html is designed to:
First attempt to load a media.json file (which would explicitly define the content),
If media.json is not present, fall back to parsing the HTML response of the directory in order to infer the file listing.
However, this fallback approach feels unreliable and somewhat hacky, since IPFS gateways are not guaranteed to return a consistent or parseable directory HTML format.
So my questions are:
Is there a recommended or standard way to handle directory listings in IPFS-backed websites?
Are there best practices for dynamically discovering files in a directory without relying on a pre-generated JSON file?
Do any gateways or tools provide a stable API for listing directory contents?
I’d appreciate any guidance or suggestions from people who have dealt with similar use cases.