feat: implement Goong API proxy with Redis caching, automatic key injection, and response filtering
All checks were successful
Build and Release / release (push) Successful in 1m31s

This commit is contained in:
2026-05-24 15:47:39 +07:00
parent 5a75798609
commit 8b3204f96e
2 changed files with 93 additions and 9 deletions

View File

@@ -86,7 +86,25 @@ func (ctrl *goongController) Proxy(c fiber.Ctx) error {
c.Set("Vary", "Origin")
c.Set("Cross-Origin-Resource-Policy", "cross-origin")
if c.Method() == "GET" {
if c.Method() == "GET" && statusCode == fiber.StatusOK {
isStaticAsset := strings.Contains(targetURL, "/tiles/") ||
strings.Contains(targetURL, "/fonts/") ||
strings.Contains(targetURL, "/glyphs/") ||
strings.HasSuffix(targetURL, ".pbf") ||
strings.HasSuffix(targetURL, ".png") ||
strings.HasSuffix(targetURL, ".jpg") ||
strings.HasSuffix(targetURL, ".webp")
if !isStaticAsset {
c.Set("Cache-Control", "no-store, no-cache, must-revalidate, max-age=0")
c.Set("CDN-Cache-Control", "no-store")
c.Set("Cloudflare-CDN-Cache-Control", "no-store")
} else {
c.Set("Cache-Control", "public, max-age=86400")
c.Set("CDN-Cache-Control", "max-age=86400")
c.Set("Cloudflare-CDN-Cache-Control", "max-age=86400")
}
} else if c.Method() == "GET" {
c.Set("Cache-Control", "no-store, no-cache, must-revalidate, max-age=0")
c.Set("CDN-Cache-Control", "no-store")
c.Set("Cloudflare-CDN-Cache-Control", "no-store")