Define CORSMaxAgeSeconds constant
This commit is contained in:
@@ -18,6 +18,9 @@ import (
|
|||||||
"sneak.berlin/go/pixa/internal/logger"
|
"sneak.berlin/go/pixa/internal/logger"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// CORSMaxAgeSeconds is the max age for CORS preflight cache (24 hours).
|
||||||
|
const CORSMaxAgeSeconds = 86400
|
||||||
|
|
||||||
// MiddlewareParams defines dependencies for Middleware.
|
// MiddlewareParams defines dependencies for Middleware.
|
||||||
type MiddlewareParams struct {
|
type MiddlewareParams struct {
|
||||||
fx.In
|
fx.In
|
||||||
@@ -104,7 +107,7 @@ func (s *Middleware) CORS() func(http.Handler) http.Handler {
|
|||||||
AllowedHeaders: []string{"Accept", "Authorization", "Content-Type"},
|
AllowedHeaders: []string{"Accept", "Authorization", "Content-Type"},
|
||||||
ExposedHeaders: []string{"Link"},
|
ExposedHeaders: []string{"Link"},
|
||||||
AllowCredentials: false,
|
AllowCredentials: false,
|
||||||
MaxAge: 86400,
|
MaxAge: CORSMaxAgeSeconds,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user