skip to Main Content

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

2

Answers


  1. Chosen as BEST ANSWER

    i think that i can understand @ben now, since header set will override previous set of a certain header, so if "onsuccess" was a subset of "always" we couldn't have sth like: x-foo: baz and x-foo: bar simultaneously

    so the example provided by @ben actually was an example that can show us "onsuccess" table used while "always" not, because
    • while we don't use any existing header it's like:
    enter image description here
    • but when you use it will be like:
    enter image description here


  2. 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.

    example

    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
    

    summary

    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
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search