Skip to content
This repository has been archived by the owner on Dec 9, 2024. It is now read-only.

Commit

Permalink
Work in progress
Browse files Browse the repository at this point in the history
  • Loading branch information
skhaz committed Nov 16, 2023
1 parent 8960a56 commit b5fae62
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,8 @@ func indexHandler(c echo.Context) error {
return fmt.Errorf("parse template error: %w", err)
}

c.Response().Header().Set("Cache-Control", "public, max-age=300, s-maxage=300")

if err := tmpl.Execute(c.Response().Writer, data); err != nil {
return fmt.Errorf("execute template error: %w", err)
}
Expand All @@ -223,7 +225,7 @@ func javaScriptHandler(c echo.Context) error {
return fmt.Errorf("get runtime error: %w", err)
}

c.Response().Header().Set("Cache-Control", "max-age=31536000")
c.Response().Header().Set("Cache-Control", "public, max-age=31536000, s-maxage=31536000")
c.Response().Header().Set("Vary", "Accept-Encoding")
c.Response().Header().Set("ETag", p.Sha1())

Expand All @@ -241,7 +243,7 @@ func webAssemblyHandler(c echo.Context) error {
return fmt.Errorf("get runtime error: %w", err)
}

c.Response().Header().Set("Cache-Control", "max-age=31536000")
c.Response().Header().Set("Cache-Control", "public, max-age=31536000, s-maxage=31536000")
c.Response().Header().Set("Vary", "Accept-Encoding")
c.Response().Header().Set("ETag", p.Sha1())

Expand All @@ -259,7 +261,7 @@ func bundleHandler(c echo.Context) error {
return fmt.Errorf("get bundle error: %w", err)
}

c.Response().Header().Set("Cache-Control", "max-age=31536000")
c.Response().Header().Set("Cache-Control", "public, max-age=31536000, s-maxage=31536000")
c.Response().Header().Set("Vary", "Accept-Encoding")
c.Response().Header().Set("ETag", p.Sha1())

Expand Down

0 comments on commit b5fae62

Please sign in to comment.