Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

static: Can't disable file listing #27

Open
elimisteve opened this issue Mar 9, 2015 · 3 comments
Open

static: Can't disable file listing #27

elimisteve opened this issue Mar 9, 2015 · 3 comments

Comments

@elimisteve
Copy link

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

@iwanbk
Copy link

iwanbk commented Dec 24, 2015

@elimisteve

r.Use(static.Serve("/static/", static.LocalFile("/yourdirectory", false)))

@robvdl
Copy link

robvdl commented Dec 24, 2015

@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.

@giter
Copy link

giter commented Oct 21, 2016

+1 for index.html

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants