Page 1 of 1

Content-Type not appearing in response

Posted: Mon Nov 13, 2006 1:55 pm
by Ollie Saunders
I'm trying to serve some XML with XSLT and I need Apache to server them both as text/xml. I added this line:

Code: Select all

AddType text/xml xml xsl xslt
to my apache2.conf but its made no difference. According to LiveHTTPHeaders and TamperData (both FireFox extensions) no Content-Type header is being sent in the response at all. Indeed to get a Content-Type header to be send I have to use PHP!

Code: Select all

header('Conten... you know the rest
Why isn't Content-Type being sent at all in the first place?
Why is my AddType declaration being ignored
Why is ForceType (another thing I tried with an .htaccess) also making absolutely no difference?!

Frankly, this is pretty damn weird, what the hell does Apache think it is doing exactly?
And no this isn't anything to do with content negotiation before my browser is clearly accepting text/xml.

Posted: Mon Nov 13, 2006 2:17 pm
by feyd
Potentially insulting question, but did you restart the server? What about editing the mime.types file instead?

Posted: Mon Nov 13, 2006 2:19 pm
by Ollie Saunders
Ha ha, no don't worry, I have missed things like that in the past. Not this time though; I did restart it.
What about editing the mime.types file instead?
No I haven't but the docs recommend you don't.
You should not edit the mime.types file, because it may be replaced when you upgrade your server.

Posted: Mon Nov 13, 2006 2:20 pm
by feyd
How often do you upgrade the server?

:P

Posted: Mon Nov 13, 2006 3:02 pm
by Ollie Saunders
Tried it. Didn't work.

EDIT: Ahhh Web Developer > Information > View Response Headers, says that content-type is text/xml. Hmm obviously the other extensions are a load of old pap then. Dammit this still doesn't explain why FireFox is refusing to apply my XSLT.

EDIT: Solved XSLT now

Code: Select all

<xsl:output method="html"
did the trick.