← Getting Started · Back to README · Configuration →
This page is for contributors and local source-based workflows.
- Go 1.24+
- Git
Build and run the server directly:
cd src
go build -o spa-to-http
./spa-to-http --directory ../test/frontend/distOr run without building a binary:
cd src
go run . --directory ../test/frontend/distOpen http://localhost:8080 in your browser.
cd src
go run . \
--directory ../test/frontend/dist \
--brotli \
--gzip \
--spa=true \
--logger \
--log-pretty \
--cache-max-age 3600 \
--threshold 2048 \
--base-path /appcd src
ADDRESS=0.0.0.0 PORT=8080 \
GZIP=true BROTLI=true \
SPA_MODE=true LOGGER=true LOG_PRETTY=true \
CACHE_MAX_AGE=3600 THRESHOLD=2048 \
DIRECTORY=../test/frontend/dist \
go run .cd src
go run . \
--directory ../test/frontend/dist \
--basic-auth "admin:secret" \
--basic-auth-realm "SPA Server"Use the built-in fixture to verify routing, caching, and compression behavior.
cd src
go run . --directory ../test/frontend/distdocker run --rm -p 8080:8080 -v $(pwd)/test/frontend/dist:/code devforth/spa-to-http:latestOpen http://localhost:8080 in your browser.
Use the local fixture at test/traefik/docker-compose.base-path.yml to emulate production routing:
spa-to-httpserves only${SPA_BASE_PATH}paths (default:/qwerty)- non-base-path requests are routed to a different backend (
whoami) spa-to-httpimage is built locally from this repository
Run from repository root:
SPA_BASE_PATH=/qwerty SPA_MODE=true \
docker compose -f test/traefik/docker-compose.base-path.yml up --buildVerify behavior:
# SPA (should return your app index)
curl -i http://localhost:8081/qwerty
# SPA asset under base path (should be served by spa-to-http)
curl -i http://localhost:8081/qwerty/vite.svg
# Not SPA (should be routed to whoami, not your app)
curl -i http://localhost:8081/
curl -i http://localhost:8081/anythingStop:
docker compose -f test/traefik/docker-compose.base-path.yml down- Getting Started — Fast Docker onboarding
- Configuration — Full options reference
- Architecture — Package structure and request flow