Hi David,

On Wed, Sep 26, 2012 at 09:45:32AM +0900, David Blomberg wrote:
> Recently had an issue develop.  A page made long ago had a 
> "Content/Type" instead of Content-type.  It was working until recently 
> and then started showing 502 errors. Issue resolved by user fixing their 
> page to have "Content-Type".

I don't believe it has worked recently, because invalid characters in
header names have been rejected for at last 1.3.15, maybe even before.
I have implemented "option accept-invalid-http-request" and -response
for this exact mistake which I had already encountered at a customer's.

>    Was looking at the rfc and seems this could be treated as an 
> invalid/non-existant Content-type:
> *************RFC2045*****************
> 
> Default RFC 822 messages without a MIME Content-Type header are taken
>    by this protocol to be plain text in the US-ASCII character set,
>    which can be explicitly specified as:
> 
>      Content-type: text/plain; charset=us-ascii
> 
>    This default is assumed if no Content-Type header field is specified.
>    It is also recommend that this default be assumed when a
>    syntactically invalid Content-Type header field is encountered. In
>    the presence of a MIME-Version header field and the absence of any
>    Content-Type header field,....
> ***********end of RFC2045 quote***********
> 
> Or is it that stray slashes in the header fields will cause these 
> failures?  Not necessarily a haproxy bug but looks like older versions 
> of haproxy may have allowed for overlooking these slash issues.

Don't confuse a slash in the header's value and a slash in the header's
name.

The correct header name is "Content-Type". Yours is called "Content/Type".
"Content-Type" is a token, "Content/Type" are two tokens with a "/" delimitor
in between.

I suspect that someone has set the header name by hand in the application
and mangled it.

You can force haproxy to let this pass through by setting
"option accept-invalid-http-response" but still the header will possibly
be rejected one step later, or be totally ignored anyway and be useless.

Quite clearly the server configuration must be fixed.

Regards,
Willy


Reply via email to