Is it possible to add custom http header in hugo using github-pages?

Hi, Is it possible to add a custom HTTP header in Hugo when deploying to GitHub pages? or does Hugo have any facility to integrate custom headers on theme or site config so that after deployment, they will work?

AFAIK, Github Pages doesn’t support custom headers. I would recommend Netlify for that. You might find this blog post helpful.

1 Like

@moorereason is right, Github doesn’t allow custom headers at the moment. You can however use the meta http-equiv tag, which is only 50% helpful, because not all header tags work in them (because the page has to be sent to the browser for them to be interpreted):

<meta http-equiv="last-modified" content="Sun, 10 Feb 2013 14:00:46 GMT " />
<meta http-equiv="cache-control" content="Private" />
<meta http-equiv="Expires" content="600" />

Yup, I am using Netlify to add custom headers now, and it’s working like a charm. Thanks, man!

1 Like

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