Content-Type not appearing in response

Need help installing PHP, configuring a script, or configuring a server? Then come on in and post your questions! We'll try to help the best we can!

Moderator: General Moderators

Post Reply
User avatar
Ollie Saunders
DevNet Master
Posts: 3179
Joined: Tue May 24, 2005 6:01 pm
Location: UK

Content-Type not appearing in response

Post 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.
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

Potentially insulting question, but did you restart the server? What about editing the mime.types file instead?
User avatar
Ollie Saunders
DevNet Master
Posts: 3179
Joined: Tue May 24, 2005 6:01 pm
Location: UK

Post 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.
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

How often do you upgrade the server?

:P
User avatar
Ollie Saunders
DevNet Master
Posts: 3179
Joined: Tue May 24, 2005 6:01 pm
Location: UK

Post 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.
Post Reply