From 79e3a7d98719f0e095d7e608c204f72fe6ed1c0f Mon Sep 17 00:00:00 2001 From: cp-20 Date: Mon, 9 Dec 2024 12:06:21 +0900 Subject: [PATCH] =?UTF-8?q?OGP=20=E3=82=92=E3=83=8D=E3=83=83=E3=83=88?= =?UTF-8?q?=E3=83=AF=E3=83=BC=E3=82=AF=E4=B8=8A=E3=81=A7=E3=82=AD=E3=83=A3?= =?UTF-8?q?=E3=83=83=E3=82=B7=E3=83=A5=E3=81=97=E3=81=AA=E3=81=84=E3=82=88?= =?UTF-8?q?=E3=81=86=E3=81=AB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- router/v3/ogp.go | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/router/v3/ogp.go b/router/v3/ogp.go index 4ae1ea4f1..d2ae7790c 100644 --- a/router/v3/ogp.go +++ b/router/v3/ogp.go @@ -1,10 +1,8 @@ package v3 import ( - "fmt" "net/http" "net/url" - "time" "github.com/labstack/echo/v4" @@ -22,16 +20,12 @@ func (h *Handlers) GetOgp(c echo.Context) error { return herror.BadRequest("invalid url") } - res, expiresAt, err := h.OGP.GetMeta(u) + // キャッシュの削除に対応するために Cache-Control でのキャッシュはしない + res, _, err := h.OGP.GetMeta(u) if err != nil { return herror.InternalServerError(err) } - expiresIn := time.Until(expiresAt) - if expiresIn > 0 { - c.Response().Header().Set(consts.HeaderCacheControl, fmt.Sprintf("public, max-age=%d", expiresIn/time.Second)) - } - if res == nil { return c.JSON(http.StatusOK, model.Ogp{ Type: "empty",