So I played around with this today and I am able to delete the Content-type
header but I cant seem to get the condition to behave. Here is example code
from my backend:

backend http_www
    server srv_name 0.0.0.0:80 maxconn 32 weight 1
*    acl is_status_304 status eq 304*
*    rspidel ^Content-type if is_status_304*

No matter what I do with the rspidel command it always deletes the
content-type header and it never follows the condition. For example the
following also deletes the content-type header:

*    rspidel ^Content-type if FALSE*

Perhaps I am not using conditions and ACLs properly?

Thanks

larry

---
Larry Root <[email protected]>
Head of Web Development | 949.207.6063
Armor Games Inc. | http://armorgames.com


On Thu, Nov 11, 2010 at 10:22 PM, Willy Tarreau <[email protected]> wrote:

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

Reply via email to