Set additional html response headers

i just found the following tool and was wondering how to add html response headers to all requests served by kirby.

1 Like

ah. using the config file. thats a good solution. thanks @texnixe for providing a live example as well.

I use .htaccess rules based on the HTML5 boilerplate.

@texnixe Do these headers do anything different or compliment this?

1 Like

Yes, you can also set these headers via .htaccess/your server config file. If you set these headers in the config file, you can set different options for different environments.

referrer policy could be set as well. but please read which value you need. following is just an example.

header('Referrer-Policy: no-referrer-when-downgrade');

about Content Security Policy: using both unsafe inline and eval options for default-src seems a bit … well unsafe.

https://content-security-policy.com/#source_list

What’s cache.cheatsheet doing?

Kind of funny - it’s just an option Kirby’s site is using, eg in the Cheatsheet’s controller:

Hopefully unraveling this mystery,
S1SYPHOS

1 Like

@daybugging Sorry, I completely overlooked your question, @S1SYPHOS thanks for your answer.

In fact, you can use any custom settings in your config file, for example, if you want to handle things differently on local and on your server, or if you want to set global variables. Options for your private plugins etc. etc.