pig.py/Caddyfile
Russell Ballestrini 6dab26d6fa Initial neopig: async media crawler with MD5 deduplication
- Multi-target concurrent crawling support
- Content-addressable vault storage (MD5 hash)
- SQLite database with page context for searchability
- Live SERP with real-time polling feed (/live)
- URI naming convention (media_uri, page_uri)
- GIF and image object-fit: contain for proper display
2025-12-21 17:26:42 -05:00

51 lines
1.3 KiB
Caddyfile

# neopig SERP Caddyfile
#
# Option 1: Simple reverse proxy with cache headers (let browser/CDN cache)
# Option 2: Use caddy-cache plugin for server-side caching
#
# Run: caddy run --config Caddyfile
:8080 {
log {
output stdout
format console
}
# Media files - immutable, cache forever
@media path /media/*
handle @media {
header Cache-Control "public, max-age=31536000, immutable"
header X-Cache-Status "HIT"
reverse_proxy localhost:8000
}
# API - no cache
@api path /api/*
handle @api {
header Cache-Control "no-cache, no-store"
reverse_proxy localhost:8000
}
# Everything else (UI)
handle {
header Cache-Control "no-cache"
reverse_proxy localhost:8000
}
}
# Alternative: Direct file serving from vault (faster, bypasses Python)
# Uncomment and adjust paths if you want Caddy to serve files directly:
#
# :8080 {
# handle /media/* {
# uri strip_prefix /media
#
# # Rewrite hash to vault path: abc123... -> ab/abc123...
# rewrite * /vault/{http.request.uri.path.0}{http.request.uri.path.1}/{http.request.uri.path}
#
# header Cache-Control "public, max-age=31536000, immutable"
# file_server {
# root /path/to/neopig
# }
# }
# }