From 2929273531041676dc60699b175ecf6d893b73a3 Mon Sep 17 00:00:00 2001 From: Thomas Zarebczan Date: Wed, 23 Jun 2021 14:39:06 -0400 Subject: [PATCH] 301 instead of 302 to support browser caching --- main.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/main.go b/main.go index 326f192..13f6626 100644 --- a/main.go +++ b/main.go @@ -121,11 +121,11 @@ func view(c *gin.Context) { resizeParams = fmt.Sprintf("&height=%s&width=%s", height, width) } if parts := regexp.MustCompile(`^(view/)?([a-f0-9]+)/(.*?)\.(.*)$`).FindStringSubmatch(url); parts != nil { - c.Redirect(302, fmt.Sprintf("%s%s:%s.%s%s", redirectBaseURL, parts[3], parts[2], parts[4], resizeParams)) + c.Redirect(301, fmt.Sprintf("%s%s:%s.%s%s", redirectBaseURL, parts[3], parts[2], parts[4], resizeParams)) return } - c.Redirect(302, redirectBaseURL+url+resizeParams) + c.Redirect(301, redirectBaseURL+url+resizeParams) return }