perl-modperl mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Andrew Mayo <>
Subject Apache::ASP and content type
Date Wed, 22 Mar 2000 13:36:45 GMT
An interesting gotcha arises if you use the simplistic approach of mapping
/asp URLs so that any request of the form


gets processed through ASP. The problem is that ASP appears to always serve
content with Content-Type set to text/html, regardless of the actual content
type. This is not completely unreasonable, of course, since HTML is what
you're supposed to be processing.

Because of this, if you set /asp redirection rather than using file
extension redirection to ASP, any relative URL on a served page is also
processed by ASP. This is fine except when the URL refers to something which
isn't HTML, for example, an image, or a script file etc. Then it is served
with the wrong content type.

Now you can get round this easily enough by using the <file> directive and
mapping, say .asp extensions to the ASP handler. But the question arises as
to whether ASP should honour the file extension wrt content type. For
instance, if I were to map .txt and .asp files to the ASP handler, it will
preprocess them and then serve both of them with a content type of
text/html. But Apache would have served the .txt file with a content type of

As I said, the problem as such is resolvable by mapping .asp files only to
ASP, but the philosophical question is whether it is legal to apply ASP
pre-processing to non-HTML content. Strictly ASP should not have an opinion
about the content type it is preprocessing but preserve the implied content
type by filename extension. Thus, a filename with the extension .txt would
be pre-processed just like a file with the extension .htm but the content
type would be text/plain for the .txt file. This would be consistent with
standard Apache, but what do you folks think?.

Of course, I may have missed some configuration option wrt all this, though
I did recheck the documentation. Apologies if I missed something obvious.

View raw message