301 instead of 302 to support browser caching
This commit is contained in:
parent
f85ba66de3
commit
2929273531
1 changed files with 2 additions and 2 deletions
4
main.go
4
main.go
|
@ -121,11 +121,11 @@ func view(c *gin.Context) {
|
||||||
resizeParams = fmt.Sprintf("&height=%s&width=%s", height, width)
|
resizeParams = fmt.Sprintf("&height=%s&width=%s", height, width)
|
||||||
}
|
}
|
||||||
if parts := regexp.MustCompile(`^(view/)?([a-f0-9]+)/(.*?)\.(.*)$`).FindStringSubmatch(url); parts != nil {
|
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
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
c.Redirect(302, redirectBaseURL+url+resizeParams)
|
c.Redirect(301, redirectBaseURL+url+resizeParams)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue