How to set http-headers in an WebApp created by IServiceMaker
Hi all, This is a small project, displaying weather pages, here https://meteo.framail.de/ I need to set the cache and expires directives in the HTTP response header, but I didn't find a hook point from my resource tree. Also a hint, how to activate TLS1.3 in the current version would be helpfull. (-; Any help appreciated, Axel ps: sources in zip archive are here: https://www.chaos1.de/downloads/meteo.zip --- PGP-Key: CDE74120 ☀ computing @ chaos claudius
Hi Axel, The usual way to do this in Twisted Web is to call request.setHeader(b'Some-Header', b'SomeValue"). If you want to set cache-control and expiration headers for the entire site, you might want to call setHeader in your root resource render method. Otherwise, you can call setHeader in each individual resource's render method, if that level of granularity is desirable. Hope this helps, L. Daniel Burr
On Dec 19, 2021, at 5:57 AM, Axel Rau <Axel.Rau@chaos1.de> wrote:
Hi all,
This is a small project, displaying weather pages, here https://meteo.framail.de/ I need to set the cache and expires directives in the HTTP response header, but I didn't find a hook point from my resource tree.
Also a hint, how to activate TLS1.3 in the current version would be helpfull. (-;
Any help appreciated, Axel
ps: sources in zip archive are here: https://www.chaos1.de/downloads/meteo.zip --- PGP-Key: CDE74120 ☀ computing @ chaos claudius
_______________________________________________ Twisted mailing list -- twisted@python.org To unsubscribe send an email to twisted-leave@python.org https://mail.python.org/mailman3/lists/twisted.python.org/ Message archived at https://mail.python.org/archives/list/twisted@python.org/message/NH35KTWVSE6... Code of Conduct: https://twisted.org/conduct
participants (2)
-
Axel Rau
-
Louis D. Burr