github / secure_headers

Manages application of security headers with many safe defaults
MIT License
3.17k stars 252 forks source link

jekyll integration #503

Closed LeoWebSEO closed 1 year ago

LeoWebSEO commented 2 years ago

I have a doubt, I don't know if I can put it here but I already looked for where it would be better and I decided here. My question and doubt and I have thought about it a lot: where do I paste the code so that the gem is applied in a jekyll project?

I have already installed the gem and everything but I don't see that it reflects the headers in the web project. So I don't know how or where to apply it, whether in head or body.

I have read the documentation and it says that it is activated automatically, but the headers are not reflected.

I remain attentive and I hope you can help me. Beforehand thank you very much.

LeoWebSEO commented 2 years ago

I have made this appendix in _config.yml:

headers:
    SecureHeaders::Configuration.default

waiting for update to see if it works.

lgarron commented 1 year ago

Jekyll is mostly a static site generator, so I wouldn't expect it to be able to run arbitrary HTTP middleware.

From what I can tell, if you want to use "just" Jekyll, then your only option is to spell out the headers and use a WEBrick server: https://jekyllrb.com/docs/configuration/webrick/

You could copy the default headers from https://github.com/github/secure_headers#default-values

LeoWebSEO commented 1 year ago

Hello, thanks for the answer.

With this solution it is only functional in development mode or locally. When I upload it to the server it doesn't work.

I already cleared cache and it doesn't work.

The site in question is leopuente.me, it's in the ipfs fleek, I don't know if a different configuration is needed. I can't find documentation about it.

I'll stay tuned, thank you.