Yuka on Nostr: Just lost several hours of my life to silly CORS issues while setting up as my Akkoma ...
Just lost several hours of my life to silly CORS issues while setting up
https://static-s.umeyashiki.org as my Akkoma media base URL
Nginx "gotcha": header inheritance.
If you put an `add_header` directive inside a location block, it completely suppresses all `add_header` directives defined in the parent server block.
```
server {
add_header "X-Hdr-A" "Value";
add_header "X-Hdr-B" "Value";
location / {
add_header "X-Hdr-C" "Value"; # <-- This wipes out A and B!
access_log /var/log/a.log;
}
location /bb {
access_log /var/log/b.log; # <-- A and B will show up here just fine.
}
}
```
If your global headers are mysteriously disappearing on certain paths, maybe check your location blocks.
#http #nginx #cors #akkoma
Published at
2026-02-24 06:09:49 UTCEvent JSON
{
"id": "11361804a798b0497dae000ddb0c0b472402d78d984424ef9935abaf659628f5",
"pubkey": "f2620b194db7db27766c3eb5e055230a16db04617dd2b4ec9b3cbfb7705385b9",
"created_at": 1771913389,
"kind": 1,
"tags": [
[
"t",
"cors"
],
[
"t",
"akkoma"
],
[
"t",
"http"
],
[
"t",
"nginx"
],
[
"emoji",
"blobthump",
"https://s.umeyashiki.org/emoji/blobs.gg/blobthump.png"
],
[
"proxy",
"https://s.umeyashiki.org/objects/9def8e7e-670f-4b65-9d3c-1886ce2f1c97",
"activitypub"
],
[
"L",
"pink.momostr"
],
[
"l",
"pink.momostr.activitypub:https://s.umeyashiki.org/objects/9def8e7e-670f-4b65-9d3c-1886ce2f1c97",
"pink.momostr"
],
[
"-"
]
],
"content": "Just lost several hours of my life to silly CORS issues while setting up https://static-s.umeyashiki.org as my Akkoma media base URL :blobthump: \r\n\r\nNginx \"gotcha\": header inheritance.\r\n\r\nIf you put an `add_header` directive inside a location block, it completely suppresses all `add_header` directives defined in the parent server block.\r\n\r\n```\r\nserver {\r\n add_header \"X-Hdr-A\" \"Value\";\r\n add_header \"X-Hdr-B\" \"Value\";\r\n\r\n location / {\r\n add_header \"X-Hdr-C\" \"Value\"; # \u003c-- This wipes out A and B!\r\n access_log /var/log/a.log;\r\n }\r\n\r\n location /bb {\r\n access_log /var/log/b.log; # \u003c-- A and B will show up here just fine.\r\n }\r\n}\r\n```\r\nIf your global headers are mysteriously disappearing on certain paths, maybe check your location blocks.\r\n\r\n#http #nginx #cors #akkoma",
"sig": "a6449b008cd828ec6576fabe5f7641fdffa4e88b3a7fe2ec421f7c72782ff03f3b171258b20e6411b97d010636fb6ee837ed9fd956bebff36f1e37df8362f66e"
}