nginx
config_error
ai_generated
true
add_header directive not inherited in nested location
ID: nginx/add-header-not-inherited
82%Fix Rate
86%Confidence
3Evidence
2023-01-01First Seen
Version Compatibility
| Version | Status | Introduced | Deprecated | Notes |
|---|---|---|---|---|
| 1 | active | — | — | — |
Root Cause
add_header directives in parent block not inherited when child has own add_header.
genericWorkarounds
-
90% success Use ngx_headers_more module: more_set_headers always inherits
-
85% success Include shared header file in each location block
Dead Ends
Common approaches that don't work:
-
Duplicate all headers in every location block
72% fail
Maintenance nightmare
-
Use server-wide headers only
68% fail
Loses per-location customization