blob: bd149914671b345b2c0b4c0a6ddeb95b982b3f56 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
|
from twisted.web.server import Site, Request
class AddCSPHeaderRequest(Request):
HEADER_VALUES = "default-src 'self'; style-src 'self' 'unsafe-inline'"
def process(self):
self.setHeader("Content-Security-Policy", self.HEADER_VALUES)
self.setHeader("X-Content-Security-Policy", self.HEADER_VALUES)
self.setHeader("X-Webkit-CSP", self.HEADER_VALUES)
Request.process(self)
class PixelatedSite(Site):
requestFactory = AddCSPHeaderRequest
|