forked from CGM_Public/pretix_original
Fixed broken Django error pages due to CSP headers
This commit is contained in:
@@ -147,6 +147,11 @@ class SecurityMiddleware:
|
|||||||
return "; ".join(k + ' ' + v for k, v in h.items())
|
return "; ".join(k + ' ' + v for k, v in h.items())
|
||||||
|
|
||||||
def process_response(self, request, resp):
|
def process_response(self, request, resp):
|
||||||
|
if settings.DEBUG and resp.status_code >= 400:
|
||||||
|
# Don't use CSP on debug error page as it breaks of Django's fancy error
|
||||||
|
# pages
|
||||||
|
return resp
|
||||||
|
|
||||||
resp['X-XSS-Protection'] = '1'
|
resp['X-XSS-Protection'] = '1'
|
||||||
h = {
|
h = {
|
||||||
'default-src': "{static}",
|
'default-src': "{static}",
|
||||||
|
|||||||
Reference in New Issue
Block a user