static: Can't disable file listing
When visiting /static/ on a webserver that uses https://github.com/gin-gonic/contrib/blob/master/static/static.go to handle requests to /static/*, I see a file listing. For security purposes, I would like to disable this.
Any thoughts on how to securely do this? Thanks!
/cc @ajvb
@elimisteve
r.Use(static.Serve("/static/", static.LocalFile("/yourdirectory", false)))
@elimisteve
I recently started using contrib/static but discovered the second paramter called "indexes" behaves a little differently to me and I am wondering if it's a bug.
With indexes set to false it won't give directory listings as expected, but it also won't automatically serve up index.html if you go to /static/ for example and there is an index.html file there.
I think this is a bug.
With indexes set to true it serves up directory listings AND going to /static/ automatically opens index.html
I think it's not right that the indexes flag controls both directory listing AND whether index.html should be loaded automatically, it seems like a bug to me and this needs to be a second argument really.
+1 for index.html