Use S3 and CloudFront for static files

This commit is contained in:
video-prize-ranch
2022-01-28 18:44:36 -05:00
parent be24ab2342
commit e3488c3527
7 changed files with 17 additions and 17 deletions

View File

@@ -8,7 +8,7 @@ import (
func FrontpageHandler(c *fiber.Ctx) error {
utils.SetHeaders(c)
c.Set("Cache-Control", "public,max-age=31557600")
c.Set("Content-Security-Policy", "default-src 'none'; style-src 'self'; img-src 'self'; font-src 'self'; block-all-mixed-content")
c.Set("Content-Security-Policy", "default-src 'none'; style-src 'self' *.cloudfront.net; img-src 'self' *.cloudfront.net; font-src 'self'; block-all-mixed-content")
return c.Render("frontpage", fiber.Map{})
}

View File

@@ -9,7 +9,7 @@ import (
func HandleGallery(c *fiber.Ctx) error {
utils.SetHeaders(c)
c.Set("Content-Security-Policy", "default-src 'none'; style-src 'self'; media-src 'self' *.cloudfront.net; img-src 'self' *.cloudfront.net; font-src 'self'; block-all-mixed-content")
c.Set("Content-Security-Policy", "default-src 'none'; style-src 'self' *.cloudfront.net; media-src 'self' *.cloudfront.net; img-src 'self' *.cloudfront.net; font-src 'self' *.cloudfront.net; block-all-mixed-content")
album, err := api.FetchAlbum(c.Params("galleryID"))
if err != nil {

View File

@@ -12,7 +12,7 @@ import (
func HandleUser(c *fiber.Ctx) error {
utils.SetHeaders(c)
c.Set("Cache-Control", "public,max-age=604800")
c.Set("Content-Security-Policy", "default-src 'none'; style-src 'self' 'unsafe-inline'; media-src 'self' *.cloudfront.net; img-src 'self' *.cloudfront.net; font-src 'self'; block-all-mixed-content")
c.Set("Content-Security-Policy", "default-src 'none'; style-src 'self' 'unsafe-inline' *.cloudfront.net; media-src 'self' *.cloudfront.net; img-src 'self' *.cloudfront.net; font-src 'self' *.cloudfront.net; block-all-mixed-content")
wg := sync.WaitGroup{}
wg.Add(2)