Prev: Next: , Up: Simple Proxy[Contents][Index]


4.4 Modifying responses

The rewrite statement can also be used to modify responses received from backends before passing them back to the querying party. To indicate this intent, the Rewrite statement must be followed by the response keyword:

Rewrite response
    SetHeader "X-Been-There: pound"
End

When modifying responses, only two request modification statements are allowed: SetHeader and DeleteHeader. The list of request matching rules is limited as well: Header and StringMatch, plus Match and Not conditionals. Notice that these conditionals operate on the response, and not on the request, as in previous chapters. For example:

Rewrite response
    Header "Content-Type:[[:space:]]+text/(.*)"
    SetHeader "X-Text-Type: $1"
End

This will insert an additional X-Text-Type header into the response. It will contain the subtype value from the Content-Type header of the original response.