2021-10-17 16:48:53 +02:00
|
|
|
package server
|
|
|
|
|
|
|
|
import (
|
|
|
|
"github.com/gin-gonic/gin"
|
2022-09-28 09:01:17 +02:00
|
|
|
|
2022-10-09 17:16:49 +02:00
|
|
|
"github.com/photoprism/photoprism/internal/config"
|
|
|
|
"github.com/photoprism/photoprism/internal/server/header"
|
2021-10-17 16:48:53 +02:00
|
|
|
)
|
|
|
|
|
2022-10-09 17:16:49 +02:00
|
|
|
// Security adds common HTTP security headers to the response.
|
|
|
|
var Security = func(conf *config.Config) gin.HandlerFunc {
|
2021-10-17 16:48:53 +02:00
|
|
|
return func(c *gin.Context) {
|
2022-10-09 17:16:49 +02:00
|
|
|
c.Writer.Header().Set(header.ContentSecurityPolicy, header.DefaultContentSecurityPolicy)
|
|
|
|
c.Writer.Header().Set(header.FrameOptions, header.DefaultFrameOptions)
|
2021-10-17 16:48:53 +02:00
|
|
|
}
|
|
|
|
}
|