How to set headers in JSON files in HUGO

We are using HUGO’s built-in JSON APIs on digital.gov (thank you)
https://github.com/GSA/digitalgov.gov/wiki/APIs

But is there a way for HUGO to set the HTTP response headers of these json files?
Otherwise, we are running in to CORS / cross-origin issues.

I’m pretty sure the response headers are generated by the web server. I don’t think digital.gov is running hugo as a server, so you’ll need to consult the web server’s response header settings. :slight_smile:

1 Like

As @maiki suggests this issue is on your server setup. You can go down the server config path setting the CORS headers, you can use a reverse proxy to serve the api on the same domain, port and scheme, or, if the api is on a subdomain, there’s also this one trick.

1 Like

That is a helpful clarification. Thank you! I will check with the Federalist team https://federalist.18f.gov/ to see how headers are being sent on upload to S3.

2 Likes