No equivalent to fancyindex_ignore?


(xnaas) #1

Hello folks, recently had Caddy recommended to me so I figured I’d give it a try.

Everything has been going well so far, but I can’t seem to find any equivalent to fancyindex_ignore from Nginx’s Fancy Ignore.

For those unfamiliar with what this does, it ignores a list of files/folders so they’re not listed. If someone knows what the folder or file is, they can manually type it in to get to it, but it’s not listed by nginx.

In this case, I’m looking for some sort of “ignore” to add to “browse” so certain folders aren’t listed. I still want the files in those folders to be completely accessible, I just don’t want the folder to be advertised.

Is this accomplishable and I’ve overlooked something? Impossible?


(Matthew Fay) #2

Hi @xnaas, welcome to the Caddy community.

There’s no functionality available in the browse directive to supply a list of files/directories that shouldn’t be listed.

That said, Caddy uses Go’s built-in text/template package to render the index pages for browse.

The template included by default can be seen here: https://github.com/mholt/caddy/blob/8369a1211544224b2967dd3ac43372a2ef432291/caddyhttp/browse/setup.go#L115-L515

You could take that, alter it to manually check that the file/folder doesn’t match what you don’t want to list, and supply the template back in the Caddyfile. It’d be a bit complicated if you’re not familiar with text/template already, though.

You could also open a ticket at https://github.com/mholt/caddy/issues and request this as a feature. One of our contributors might be able to implement what you’re after.


(xnaas) #3

Hello @Whitestrake and thanks for the welcome!

I appreciate pointing me in the right direction for some customization. I’ve never touched the Go language in any way, shape, or form, so it may take me some time to dig through this information and come up with the solution I’m looking for.

I know there’s a similar issue on github that was suggested some time ago, but I’m not sure if it’s exactly the same or not.

Thanks again for the information and I’ll see what I can come up with. If I find a more detailed/specific solution, I will definitely share it here in case anyone else runs into the same thing.