Static web server with reverse proxy, cache control, and Apache-style logging, written in Go.
1.3K
https://gitlab.com/jlcox70/serve-proxyā
š¦ Go Static Web Server with Reverse Proxy and Apache Logging This lightweight and production-ready Go web server is designed to serve static web apps (like Vue.js builds), apply per-file Cache-Control headers, reverse proxy selected paths to backend services, and log all requests in Apache Common Log Format.
ā Features Static File Hosting ā Serve compiled frontend apps from any path (configurable web_root)
Reverse Proxy ā Forward API routes to HTTP/HTTPS backends with optional TLS validation
Cache Control ā Set Cache-Control headers based on file extensions
Apache-style Logging ā Logs all requests with real client IPs via X-Real-IP or X-Forwarded-For
Self-config Help Page ā If web_root is not configured, responds with a setup guide
No Redirects ā / and /web_root/ serve your index.html cleanly without 301s
Fully Dockerized ā Lightweight final image using scratch or distroless
š§ Configuration Configure the server using a config.yaml file:
port: 8080
static_dir: "./dist"
web_root: "/app"
cache_control:
".js": "max-age=86400"
".html": "no-cache"
proxies:
"/api":
target: "https://api.example.com"
insecure_skip_tls: true
š Usage
docker run -v $(pwd)/dist:/app/dist \
-v $(pwd)/config.yaml:/app/config.yaml \
-e CONFIG_PATH=/app/config.yaml \
-p 8080:8080 \
go-web-server
Then open:
http://localhost:8080/ā ā loads index.html
http://localhost:8080/app/ā ā static frontend
http://localhost:8080/api/ā ... ā proxied to backend
š License GPLv3 ā See LICENSE for full details.
Content type
Image
Digest
sha256:161b87503ā¦
Size
4.9 MB
Last updated
4 months ago
docker pull jlcox1970/serve-proxy:2.0.7