add_header is a giant foot gun

Bug #1966385 reported by Michael
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Nginx
New
Undecided
Unassigned

Bug Description

Side effects are often the cause of bugs. Explicit is better than implicit.

To quote this link:
https://www.peterbe.com/plog/be-very-careful-with-your-add_header-in-nginx

> "add" doesn't usually mean "subtract everything else"

The Nginx add_header is very counter intuitive, because it removes all other headers, for example when used in a location block.

Could we please get an `append_header` to add a header without removing the others, and a `clear_headers` if one wishes to reset the headers. This way there is no hidden magic. I do not feel strongly about the proposed solution, but a way in which to keep all headers, and add one more, e.g. a caching strategy to a certain location block, would be great.

Revision history for this message
Thomas Ward (teward) wrote (last edit ):

This is a request for a new feature from upstream and needs filed at NGINX, not here. The Nginx 'project' here is not the upstream NGINX team.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.