How do I add custom HTTP headers to a hosted static site?

Posted January 1, 2021 1.1k views
GitDigitalOceanHTMLSpin UpDigitalOcean App Platform

How do I setup Digital Ocean’s static sites with custom headers, like “Referrer-Policy”?

Netlify let’s you set custom headers for static sites by adding to their TOML file:

  for = "/*"
    Referrer-Policy = "no-referrer"
    X-Content-Type-Options = "nosniff"
    X-Frame-Options = "deny"
    X-XSS-Protection = "1; mode=block"

What’s the equivalent for an app spec on Digital Ocean?

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Submit an Answer
1 answer

Thanks for the question. This functionality isn’t currently available for static sites components in the App Platform. We’ll consider this as a feature. Service type components can set any headers as they respond to requests.