Lightweight, fast, self-hosted shortlink redirection service written in Rust
327
A lightweight, fast, self-hosted shortlink redirection service written in Rust, using Axum and Sqlx with SQLite.
Point a domain at it, mount a volume, and start creating short links backed by a single SQLite file — no external database required.
http:// and https:// targets are accepted/ redirects to a landing page or repo URL of your choicelinux/amd64 and linux/arm64docker run -d \
--name redirectr \
-p 3333:3333 \
-v redirectr_data:/data \
-e ADMIN_TOKEN="your-super-secret-token" \
-e DEFAULT_URL="https://example.com" \
andybzn/redirectr:latest
Or with Compose:
services:
redirectr:
image: andybzn/redirectr:latest
container_name: redirectr
restart: unless-stopped
ports:
- "3333:3333"
environment:
ADMIN_TOKEN: "your-super-secret-token"
DEFAULT_URL: "https://example.com"
volumes:
- redirectr_data:/data
volumes:
redirectr_data:
The image binds SERVER_IP=0.0.0.0 and points DATABASE_URL at /data by default — just mount a volume there so links persist across restarts.
| Variable | Required | Default | Description |
|---|---|---|---|
ADMIN_TOKEN | Yes | — | Bearer token required to create links via POST /. |
SERVER_IP | No | 0.0.0.0 (in-image) | IP address the HTTP server binds to. |
SERVER_PORT | No | 3333 | TCP port the HTTP server listens on. |
DATABASE_URL | No | sqlite:///data/redirectr.sqlite | SQLite connection URL (created automatically if missing). |
MAX_CONN | No | 9 | Maximum SQLite connection pool size. |
DEFAULT_URL | No | https://github.com/andybzn/redirectr | Fallback destination for GET /. |
RUST_LOG | No | redirectr=debug,sqlx=warn | tracing subscriber log filter level. |
GET /{code} — 302 to the target URL, 404 if unknownPOST /?code=<code>&url=<target_url> — create a link (requires Authorization: Bearer <ADMIN_TOKEN>)GET / — 302 to DEFAULT_URLGET /health — 200 if the database is reachable, 503 otherwiselatest — most recent build from main<short-sha> — pinned build for a specific commitSource, issues, and full docs: https://github.com/andybzn/redirectr
Licensed under MIT.
Content type
Image
Digest
sha256:bef0ec6d5…
Size
2.6 MB
Last updated
about 2 months ago
docker pull andybzn/redirectr