You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Phil Endecott <sp...@chezphil.org> on 2005/02/03 23:33:06 UTC
[users@httpd] Re: RequestHeader before content negotiation
I asked:
> I have been struggling to get content negotiation to work due to the
> broken Accept: headers that browsers send. I hoped that I could fix
> this by using mod_header's RequestHeader to correct the Accept:
> headers in incoming requests. But it seems that the order in which
> things happen is such that content negotiation has happened before
> RequestHeader is applied. Is this right? If so, can anyone think of
> a hack? Maybe this should be changed?
Joshua replied:
> Apache httpd 2.1 (the development version) has an "early" flag to the
> RequestHeader directive that can be used to change the header earlier
> in the processing. I don't believe this is available in 2.0 or 1.3.
That sounds like what I need, thanks, I'll investiage.
(Is there any case when it is necessary to do it late? Couldn't "early"
be the only choice?)
> Perhaps if you explained exactly what type of problem you are trying
> to fix, we could provide alternate solutions.
Have a look at https://bugzilla.mozilla.org/show_bug.cgi?id=280812 for
the whole story. Basically, I want to do content negotiation but
Mozilla doesn't send an accurate Accept: header (and IE is as bad or
worse). Apache's algorithm could be made to work if we could hack these
headers on the way in.
Specifically I have an animation available in both MNG and GIF formats.
When retrieving something for an <IMG> tag Mozilla sends "Accept:
image/png,*/*;q=0.5". This appears to claim to support both formats
with q=0.5, so the server algorithm selects the one with the best qs
value or failing that the smallest file size. This is the MNG file. Of
course Mozilla can display animated GIFs perfectly and MNGs not at all,
so this is wrong.
Mozilla's attitude is that "everyone knows that all browsers understand
GIF and JPEG, so we won't advertise the fact and so save ourselves 21
bytes in every request". What I'd like to do is to codify this
statement by having
if browser==Mozilla {
append "image/jpeg,image/gif;q=0.8" to Accept: header
}
before content negotiation is applied.
Presumably similar rules could be applied for other browsers, when
necessary.
I'd like to take a pragmatic, rather than purist, attitude to solving
this problem, if that's OK with people...
--Phil.
---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
" from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org