On Thu, Nov 11, 2010 at 04:28:46PM -0800, Larry Root wrote:
> Im struggling to figure out how to modify the *Response* headers within
> haproxy. Here is the logic I would like to implement:
>
> IF response_status_code == 304 THEN remove header "Content-Type"
>
> I believe I need to setup an ACL rule to capture the status code part, and
> then use rspidel to conditionally remove the Content-Type header based on
> the ACL rule. However Im struggling with how to specify this ACL rule for
> the response status code. Im also not sure where to place this logic, in the
> frontend or backend? Any support would be greatly appreciated.
You could place it in either the frontend or backend. The rule of thumb is
to consider that what it relevant to the server farm should be done in the
backend, and what is relevant to the access point should be done in the
frontend. So if you have to remove that header because of a buggy client
it would be better to do it in the frontend, and if it's because the server
is stupid, then better in the backend.
I think the following rule should work :
rspidel ^Content-type if { status 304 }
However, I don't really understand why you'd want to remove the header in
such a case, as a 304 is supposed to return the exact same headers as the
200 !
Regards,
Willy