apache official documentaion says that:
• "onsuccess (default)" responses headers table → just for 2xx responses
• "always" responses headers table → for all responses including 2xx
later it says:
always is not a superset of onsuccess
if "always headers response table" includes 2xx, how it can not be a super set of "onsuccess"?
please consider that i've red full document so please do not repeat quotes of apache documents, i need answer not quotings :), thanks for your time
You missed an import part of the statement
always is not a superset of onsuccess with respect to existing headers:
It is a little confusing, but if you read the documentation you linked to it does explain it.
This difference between onsuccess and always is a feature that resulted as a consequence of how httpd internally stores headers for a HTTP response, since it does not offer any "normalized" single list of headers.
Here's my attempt to make the example from the docs more clear:
step 1 - Your Application
response.status = 200
response.headers['X-Foo'] = 'bar'
return response
step 2: mod_proxy
mod_proxy sets headers in the always table and not in the default onSuccess table
apache header tables:
Always | onSuccess |
---|---|
x-Foo: bar |
step 3: mod_headers
Header onSuccess set X-Foo: baz
apache header tables:
Always | onSuccess |
---|---|
x-Foo: bar |
X-Foo: baz |
step 4: server response
HTTP/1.1 200
Server: apache
x-Foo: bar
X-Foo: baz
That's the reason the doc state
always is not a superset of onsuccess with respect to existing headers.
and that
repeating this directive with both conditions makes sense in some scenarios
Again from the example, you can resolve the issue with:
mod_headers
Header always unset X-Foo
Header onSuccess set X-Foo: baz