Open ncresswell opened 7 years ago
Hi!
That's a cool idea, I"m starting to work on that.
File listing should be working without modifications according to the actual implementation :smile:
Hmm it didnt work when i tried it...
Rgds,
Neil Cresswell
On 14/11/2017, at 12:14 PM, Pierre Zemb notifications@github.com<mailto:notifications@github.com> wrote:
File listing should be working without modifications according to the actual implementation 😄
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://urldefense.proofpoint.com/v2/url?u=https-3A__github.com_PierreZ_goStatic_issues_7-23issuecomment-2D344091259&d=DwMFaQ&c=euGZstcaTDllvimEN8b7jXrwqOf-v5A_CdpgnVfiiMM&r=0fx0h4vB56iTLpw2McH1ZD6TqG_QGpbggVOB-PfMJpM&m=NLehk3R1CLEN6kx9Sw60ctvYX4qosR6QG7PkoM20ot4&s=eAxXw-aKqLKJp7XOnM8tomnn-j_fEYYVGVK3AemA3cQ&e=, or mute the threadhttps://urldefense.proofpoint.com/v2/url?u=https-3A__github.com_notifications_unsubscribe-2Dauth_AWGrld-5F0h1M2zisGqGFySuVfuBRYm2szks5s2M01gaJpZM4QapOY&d=DwMFaQ&c=euGZstcaTDllvimEN8b7jXrwqOf-v5A_CdpgnVfiiMM&r=0fx0h4vB56iTLpw2McH1ZD6TqG_QGpbggVOB-PfMJpM&m=NLehk3R1CLEN6kx9Sw60ctvYX4qosR6QG7PkoM20ot4&s=WVQga7BoCFWaCRHDLQ_C6N8Ntkm8NBdhqyBYYLEMng8&e=.
I just tried this:
./goStatic --path /home/pierre/workspace/personal/go/src/github.com/PierreZ/goStatic
2017/11/14 00:36:17 Listening at 0.0.0.0:8043...
# in another terminal
curl localhost:8043
<pre>
<a href=".git/">.git/</a>
<a href=".gitignore">.gitignore</a>
<a href=".travis.yml">.travis.yml</a>
<a href="Dockerfile">Dockerfile</a>
<a href="LICENSE">LICENSE</a>
<a href="README.md">README.md</a>
<a href="auth.go">auth.go</a>
<a href="goStatic">goStatic</a>
<a href="main.go">main.go</a>
</pre>
Now sorry to ask this. But is there a way to turn off directory listing?
I'm planning to use this as a static file server for js,fonts,css,etc. And I dont want people to browse the assets.
This is probably a bit late for you, shantanuthatte, but here's a little workaround for others that have landed here through Google.
Create an index.html
file in the directory that you want to disable listings in I've created an empty one and now file listings don't occur.
Hello! Sorry to "re-open" that discussion but I'm facing a similar issue.
Maybe it's a good idea to add an option to answer with an HTTP error (403? 404? configurable?) when trying to access a directory with listing sets to off? Like Apache/Nginx do. Above solution is a working workaround but do not satisfy all use cases I think (because it prints a blank page and returns a valid HTTP code which does not really make sense).
Even if traditional webservers enable that feature by default, it may lead to a number of issues in a production environment. So, I propose to disable it by default and add an option called like "-enable-directory-listing". What do you think of that?
I agree with you @utarwyn, would you like to open a PR? :rocket:
Hi there, is there any way to have this web server display a list of files in a directory rather than render the HTML? I would love to mount a persistent volume (that contains a bunch of files) to /srv/http and then be able to open the webpage of goStatic to download files from within that persistent volume