You can configure Apache to send Content-Type headers automatically. Are you sending one explicitly from your script? Depending on if or how the server parses things, you may have to do more work to get the right stuff to the browser.
If you're using CGI.pm, just use the header() method.