Nginx Config to Add "Access-Control-Allow-Origin" header for /.well-known/openpgpkey

I really tried my best to figure this out before posting, and I’m sorry if there was a previous post or thread that answered this question. I am setting up a WKD server for PGP keys that are stored at The PGP keys must be in a binary format, and must include a header allowing any origin i.e., “Access-Control-Allow-Origin: *”

I did not want to edit the template or the nginx.conf files because they will be reset on update. Instead, I made the changes to “nginx.conf_openpgpkey” and hopefully that file will not be erased on update. My nginx.conf_openpgpkey file reads:

location /.well-known/openpgpkey {
allow all;
auth_basic off;
log_not_found off;
default_type “application/octet-stream”;
add_header Access-Control-Allow-Origin * always;
root /home/username/web/;

Nginx will restart without error. However, the PGP key is served without the header. I’m out of ideas as to why it isn’t working. I was able to get the header set using the same config file on without another domain so I’m confused why it will not work here.

I appreciate all of your help!