1
0
mirror of https://github.com/pocketbase/pocketbase.git synced 2025-03-20 22:36:00 +02:00

skip Cache-Control header for the Admin UI root path

This commit is contained in:
Gani Georgiev 2023-04-21 10:28:28 +03:00
parent bd2521b14b
commit 92dcee7250

View File

@ -203,7 +203,11 @@ func updateTotalAdminsCache(app core.App) error {
func uiCacheControl() echo.MiddlewareFunc {
return func(next echo.HandlerFunc) echo.HandlerFunc {
return func(c echo.Context) error {
c.Response().Header().Set("Cache-Control", "max-age=1209600, stale-while-revalidate=86400")
// add default Cache-Control header for all Admin UI resources
// (ignoring the root admin path)
if c.Request().URL.Path != trailedAdminPath {
c.Response().Header().Set("Cache-Control", "max-age=1209600, stale-while-revalidate=86400")
}
return next(c)
}