Debugging HTTP headers in Hugo

Hugo can add all headers, including security headers, on the local server ( when you type hugo server in the terminal). It’s pretty helpful for the debug, as some can break your website.

I had a problem setting them at first, but it occurred to me it …


This content originally appeared on DEV Community and was authored by ·ſ

Hugo can add all headers, including security headers, on the local server ( when you type hugo server in the terminal). It's pretty helpful for the debug, as some can break your website.

I had a problem setting them at first, but it occurred to me it was a small typo in the documentation, as it does not work well if you target .html only:

read the thread

The documentation has been updated since then, and you can test headers locally with a few lines in config.toml, for example:

[server]
    [[server.headers]]
        for = '/**'
        [server.headers.values]
            Permissions-Policy = "interest-cohort=()"
            Strict-Transport-Security = "max-age=31536000; includeSubDomains"
            X-Frame-Options = "SAMEORIGIN"
            X-Content-Type-Options = "nosniff"

See complete documentation


This content originally appeared on DEV Community and was authored by ·ſ


Print Share Comment Cite Upload Translate Updates
APA

·ſ | Sciencx (2021-11-14T09:57:10+00:00) Debugging HTTP headers in Hugo. Retrieved from https://www.scien.cx/2021/11/14/debugging-http-headers-in-hugo/

MLA
" » Debugging HTTP headers in Hugo." ·ſ | Sciencx - Sunday November 14, 2021, https://www.scien.cx/2021/11/14/debugging-http-headers-in-hugo/
HARVARD
·ſ | Sciencx Sunday November 14, 2021 » Debugging HTTP headers in Hugo., viewed ,<https://www.scien.cx/2021/11/14/debugging-http-headers-in-hugo/>
VANCOUVER
·ſ | Sciencx - » Debugging HTTP headers in Hugo. [Internet]. [Accessed ]. Available from: https://www.scien.cx/2021/11/14/debugging-http-headers-in-hugo/
CHICAGO
" » Debugging HTTP headers in Hugo." ·ſ | Sciencx - Accessed . https://www.scien.cx/2021/11/14/debugging-http-headers-in-hugo/
IEEE
" » Debugging HTTP headers in Hugo." ·ſ | Sciencx [Online]. Available: https://www.scien.cx/2021/11/14/debugging-http-headers-in-hugo/. [Accessed: ]
rf:citation
» Debugging HTTP headers in Hugo | ·ſ | Sciencx | https://www.scien.cx/2021/11/14/debugging-http-headers-in-hugo/ |

Please log in to upload a file.




There are no updates yet.
Click the Upload button above to add an update.

You must be logged in to translate posts. Please log in or register.