Skip to main content

static-http

static-http is a tiny dependency-free Python utility that starts a temporary static HTTP server in the current directory with byte-range support for quick local workflows.

It is intentionally focused on temporary file serving for local development, manual testing, media playback, and archive inspection.

Why this exists

python -m http.server is excellent for quick sharing but does not implement byte-range request handling. static-http fills that gap with a small CLI that keeps the behavior predictable and easy to reason about.

Install

uvx static-http
pipx run static-http
python -m pip install static-http

Quick start

static-http
uvx static-http

By default:

  • Serves the current working directory.
  • Binds to 0.0.0.0.
  • Listens on port 8080.
  • Uses a threaded HTTP server.
  • Handles GET, HEAD, and single-range requests.
  • Sends Cache-Control: no-cache, max-age=0, must-revalidate so browsers revalidate reused local URLs.
  • Sends Last-Modified and ETag validators for file responses.
  • Hides dot-prefixed and platform-hidden files/directories unless --include-hidden is used.

CLI

static-http supports these options:

  • -p, --port PORT — listening port. 0 requests an OS-assigned port.
  • -d, --directory PATH — root directory to serve. Default is the current directory.
  • -b, --bind ADDRESS — bind address. Default is 0.0.0.0.
  • --localhost-only — equivalent to --bind 127.0.0.1.
  • --cors — adds Access-Control-Allow-Origin: *.
  • --header "Name: Value" — repeatable custom headers.
  • --no-dir-list — disable directory listing responses when no index file exists.
  • --open — open the server URL in the default browser after startup.
  • --qr — render a terminal QR code for the server URL.
  • --no-cache — send Cache-Control: no-store instead of the default revalidation policy.
  • --quiet — explicitly keep per-request logs suppressed. This is the default.
  • --verbose — print detailed startup/binding information.
  • --include-hidden — include dot-prefixed and platform-hidden files/directories in normal serving and directory listings.
  • --version — print package version and exit.
  • --about — print project and license information and exit.

Examples

static-http --open
static-http --qr
static-http --no-cache
static-http --quiet
static-http --verbose
static-http --include-hidden
static-http --port 9000 --cors
static-http --no-dir-list

QR codes

--qr prints a terminal QR code for the selected server URL. For the default all-interface bind, it prefers a discovered LAN URL when one is available; otherwise it falls back to localhost.

The built-in QR renderer is intentionally dependency-free and sized for normal localhost/LAN URLs. If the URL is too long or the terminal is too narrow, static-http prints a warning and keeps serving.

Shutdown

Press Q or q in the focused terminal to stop the server. Ctrl+C also triggers a graceful shutdown.

Range support

GET requests support single byte ranges with examples:

curl -H "Range: bytes=0-99" http://localhost:8080/video.mp4 -o part.bin
curl -H "Range: bytes=100-" http://localhost:8080/video.mp4 -o tail.bin
curl -H "Range: bytes=-500" http://localhost:8080/video.mp4 -o suffix.bin

The server returns 206 Partial Content for satisfiable ranges, 416 Range Not Satisfiable when the range is outside the file, and 400 Bad Request for invalid range syntax.

Security note

static-http is intentionally a temporary local development/file-serving tool, not a production web server.

By default it binds to 0.0.0.0, which can expose the selected directory to other clients that can reach your machine. It has no authentication, authorization, TLS, upload handling, or production hardening. Use --localhost-only when you only need access from the same machine, and use trusted networks for LAN sharing.

License

MIT

Metadata

Release files for static-http 1.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for static-http 1.0.1
File Size Uploaded
static_http-1.0.1.tar.gz 22.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for static-http 1.0.1
File Interpreter ABI Platform
static_http-1.0.1-py3-none-any.whl Python 3 none any Details

Total release size: 39.7 kB

Release files / static_http-1.0.1.tar.gz

Download URL static_http-1.0.1.tar.gz
Size 22.5 kB
Tags Source
SHA-256 checksum
How to use checksums
86bf4fc3365522a05b572f399c50be318defbde5b76fbfbdd3acb4f126dcc4b5
BLAKE2b-256 checksum
How to use checksums
e1e56f54de8fd69acba525c813335889a7e827f6623b2f30f521984557f3986b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jul 6, 2026.

Transparency log

Release files / static_http-1.0.1-py3-none-any.whl

Download URL static_http-1.0.1-py3-none-any.whl
Size 17.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
99b1ed4d28eb5eeddda4126d09901ff9e35655cff81ecdc703327e2c09fe7ff6
BLAKE2b-256 checksum
How to use checksums
f7ad33f6a6ad324f5476546848d38f7f54616e38cc4476b98a08c302687c97db
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jul 6, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

1.0.1 This release

2 release files

1.0.0

2 release files

0.1.5

2 release files

0.1.4

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page