https://github.com/sgaunet/httpfileserver
Simple HTTP file server in Go with basic authentication support. Exposes directories via HTTP.
https://github.com/sgaunet/httpfileserver
basic-auth docker file-server go golang http-server static-files web-server
Last synced: about 1 month ago
JSON representation
Simple HTTP file server in Go with basic authentication support. Exposes directories via HTTP.
- Host: GitHub
- URL: https://github.com/sgaunet/httpfileserver
- Owner: sgaunet
- License: mit
- Created: 2022-03-22T16:51:17.000Z (about 4 years ago)
- Default Branch: master
- Last Pushed: 2026-01-19T20:41:44.000Z (3 months ago)
- Last Synced: 2026-01-21T02:52:56.781Z (2 months ago)
- Topics: basic-auth, docker, file-server, go, golang, http-server, static-files, web-server
- Language: Go
- Size: 40 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 6
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
README
[](https://github.com/sgaunet/httpfileserver/releases/latest)
[](https://goreportcard.com/report/github.com/sgaunet/httpfileserver)


[](https://github.com/sgaunet/httpfileserver/actions/workflows/coverage.yml)
[](https://github.com/sgaunet/httpfileserver/actions/workflows/linter.yml)
[](https://github.com/sgaunet/httpfileserver/actions/workflows/snapshot.yml)
[](https://github.com/sgaunet/httpfileserver/actions/workflows/release.yml)
[](LICENSE)
# httpfileserver
A simple webserver in Golang to expose a directory by http.
You can use the binary (releases) or the docker image (from scratch, it's a multi-arch image).
There is a possibility to add a basic auth by defining environment variable :
* HTTP_USER
* HTTP_PASSWORD
## Configurable Timeouts
HTTP server timeouts can be configured via command-line flags or environment variables:
| Flag | Environment Variable | Default | Description |
|------|---------------------|---------|-------------|
| `--read-timeout` | `HTTP_READ_TIMEOUT` | `30s` | HTTP read timeout |
| `--write-timeout` | `HTTP_WRITE_TIMEOUT` | `30s` | HTTP write timeout |
| `--idle-timeout` | `HTTP_IDLE_TIMEOUT` | `120s` | HTTP idle timeout |
Values accept Go duration strings (e.g., `30s`, `5m`, `1h30m`). Minimum is `1s`. Flags take priority over environment variables.
```bash
# Command-line flags
httpfileserver -d /data -p 8081 --read-timeout 60s --write-timeout 120s
# Environment variables
export HTTP_WRITE_TIMEOUT=300s
export HTTP_IDLE_TIMEOUT=600s
httpfileserver -d /data
```
## Health Check Endpoint
A `/health` endpoint is available for container orchestration and monitoring. It returns HTTP 200 with `{"status":"ok"}` and does not require authentication.
```yaml
# Kubernetes probe example
livenessProbe:
httpGet:
path: /health
port: 8081
# Docker Compose example
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:8081/health"]
interval: 30s
```
## Project Disclaimer
This software project is released under the MIT License and was created primarily for fun and testing purposes. While it may offer some interesting functionalities, please note:
* Intended Use
* This project is experimental in nature
* It serves as a playground for ideas and concepts
* The code may not be optimized or production-ready
## Recommendation
If you find the features provided by this project useful or intriguing, we strongly recommend exploring more mature and established solutions for your actual needs. This project is not intended to compete with or replace professional-grade software in its domain.
## Contributions
While we appreciate your interest, please understand that this project may not be actively maintained or developed further. Feel free to fork and experiment with the code as per the MIT License terms.
Thank you for your understanding and enjoy exploring!
# Build
This project is using :
* golang 1.17+
* [task for development](https://taskfile.dev/#/)
* docker
* [docker buildx](https://github.com/docker/buildx)
* docker manifest
* [goreleaser](https://goreleaser.com/)
## Binary
```
task
```
## Docker Image
```
task image
```
# Release
## Snapshot
```
task snapshot
```
## Release
```
task release
```