Skip to content

Commit

Permalink
Add Access-Control-Allow-Origin to all media
Browse files Browse the repository at this point in the history
  • Loading branch information
ahosgood committed Jan 10, 2025
1 parent fd70aa5 commit 1db78a8
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 12 deletions.
3 changes: 3 additions & 0 deletions .platform.app.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,9 @@ web:
root: media
expires: 1y
allow: true
# Apply rules to all static files (dynamic files get rules from your app)
headers:
Access-Control-Allow-Origin: *

# The following block defines a single writable directory, 'web/uploads'
# The 'source' specifies where the writable mount is. The 'local' source
Expand Down
1 change: 0 additions & 1 deletion config/settings/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,6 @@
"whitenoise.middleware.WhiteNoiseMiddleware",
"wagtail.contrib.redirects.middleware.RedirectMiddleware",
"etna.core.middleware.InterpretCookiesMiddleware",
"etna.core.middleware.CorsMiddleware",
]

COOKIE_DOMAIN = os.getenv("COOKIE_DOMAIN", "nationalarchives.gov.uk")
Expand Down
11 changes: 0 additions & 11 deletions etna/core/middleware.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,14 +79,3 @@ def process_template_response(
),
)
return response


# TODO: Remove once on AWS
class CorsMiddleware:
def __init__(self, get_response):
self.get_response = get_response

def __call__(self, request):
response = self.get_response(request)
response["Access-Control-Allow-Origin"] = "*"
return response

0 comments on commit 1db78a8

Please sign in to comment.