I'm looking to make a new Wagtail site production-ready and have used some Django security middleware settings such as SECURE_BROWSER_XSS_FILTER and SECURE_HSTS_SECONDS.
One HTTP header which doesn't seem to be provided for in the security middleware is Expect-CT. I'd like this header to (preferably conditionally on (a) setting(s) in the production.py settings file) have a value like:
max-age=31536000, enforce, report-uri="https://username.report-uri.com/r/d/ct/enforce"
What would be a good way to implement this and other custom HTTP headers in Wagtail?
I have looked at the existing security middleware and tried to create my own middleware in a file within my Wagtail project, but am not sure how to reference a file/module within my project in the base.py file. (I'm currently a Wagtail/Django/Python beginner.) Thanks.
Edit: I expect it might be worth me attempting a pull request to the security middleware, but adding custom headers to a site on a per-project/ad-hoc basis would be something I'd like to be able to do.