Bug 19626 - MIME-type rewriting of the actually returned MIMI-type does not work
Summary: MIME-type rewriting of the actually returned MIMI-type does not work
Alias: None
Product: Apache httpd-2
Classification: Unclassified
Component: mod_rewrite (show other bugs)
Version: 2.0.45
Hardware: PC Linux
: P3 normal (vote)
Target Milestone: ---
Assignee: Apache HTTPD Bugs Mailing List
Depends on:
Reported: 2003-05-03 23:28 UTC by Elmar Hoffmann
Modified: 2004-11-16 19:05 UTC (History)
0 users


Note You need to log in before you can comment on or make changes to this bug.
Description Elmar Hoffmann 2003-05-03 23:28:56 UTC
On Apache 1.3.27 I successfully use the following to set the MIME-type
of XHTML files to text/html instead of the default
application/xhtml+xml for browsers that can't handle the latter:

RewriteCond %{REQUEST_FILENAME} "\.xhtml$"                      [NC]
RewriteCond %{HTTP_ACCEPT}      "!application/xhtml\+xml"       [OR]
RewriteCond %{HTTP_ACCEPT}      "application/xhtml\+xml\s*;\s*q=0([^.]|$)"
RewriteRule .*                  -                               [PT,T=text/html]

On Apache 2.0.44 and 2.0.45 this however does not work, ie. the XHTML
files are always delivered with a Content-Type of application/xhtml+xml.
I get the following rewrite log when simply fetching /index.xhtml with

::1 - - [08/Apr/2003:23:00:46 +0200]
[wren.elho.net/sid#811a9d8][rid#846cdd8/initial] (4) RewriteCond:
input='/index.xhtml' pattern='\.xhtml$' => matched
::1 - - [08/Apr/2003:23:00:46 +0200]
[wren.elho.net/sid#811a9d8][rid#846cdd8/initial] (4) RewriteCond: input='*/*'
pattern='!application/xhtml\+xml' => matched
:1 - - [08/Apr/2003:23:00:46 +0200]
[wren.elho.net/sid#811a9d8][rid#846cdd8/initial] (2) remember /index.xhtml to
have MIME-type 'text/html'
::1 - - [08/Apr/2003:23:00:46 +0200]
[wren.elho.net/sid#811a9d8][rid#846cdd8/initial] (1) pass
 through /index.xhtml

This shows that the conditions work and the RewriteRule gets applied,          
                    but Apache either seems to "forget" to actually set the
MIME-type to                                text/html or something (some
filter?) happening after mod_rewrite set                               it, sets
it back again.                                                                 
           As for possibly interfering filters, disabling mod_deflate and      
                               mod_headers didn't change anything.
Comment 1 André Malo 2003-05-04 15:54:37 UTC
It *may* work if you permute the LoadModule directives of mod_rewrite and
mod_mime. Final fix is in progress.

Thanks for the report and thanks for using Apache.
Comment 2 André Malo 2003-05-13 22:53:10 UTC
FYI: The fix has been merged into the stable tree and will be in the next
release (2.0.46).