HUGO

Can't make the local server use headers

Hi,

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

I can’t make the above config work on my local server. I’m obviously doing it wrong, but I don’t understand why. Can you help?

At first glance (and this may look like a glitch in the documentation, too – I have updated it to be in line with how I think it works), it looks like it is currently hard to match only HTML files, see:

These are currently matched by their RequestURI, which does not contain any file suffix (unless you have uglyURLs turned on).

But for your use case, I suspect that if change it to for = '/**', you should be able to test what you wanted … or that is, I suspect, currently your best option.

1 Like

It’s perfect for my use case. Thanks for your help.

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.