How to set http-headers in an WebApp created by IServiceMaker
![](https://secure.gravatar.com/avatar/fe0e19b4f5ad48ae3fb31479f181bae3.jpg?s=120&d=mm&r=g)
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
![](https://secure.gravatar.com/avatar/c1cd4fcd6c951797d9567954cf2ccca0.jpg?s=120&d=mm&r=g)
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
![](https://secure.gravatar.com/avatar/c1cd4fcd6c951797d9567954cf2ccca0.jpg?s=120&d=mm&r=g)
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
participants (2)
-
Axel Rau
-
Louis D. Burr