malformed header when serving .exe files

Posted on 2006-06-01
Last Modified: 2010-03-04

I am trying to get apache to serve .exe files by executing them as CGI scripts.  My program seems fine, but I receive internal server error when viewing the page in a browser:

Internal Server Error
The server encountered an internal error or misconfiguration and was unable to complete your request.

Here is from the log file:
[Thu Jun 01 08:24:03 2006] [error] [client] malformed header from script. Bad header=<!DOCTYPE HTML PUBLIC "-//W3C/: index.exe

If I run my program from command window, it looks like this(this is just the first few lines):
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"




<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">

How do I configure apache to serve the header information correctly?  I suppose I could try and just put it directly into my program but is there another way?
Question by:bryanlloydharris
    LVL 10

    Accepted Solution

    At a bare minimum, output "Content-type: text/html" followed by two newlines (i.e. leaving one blank line before start of body).

    LVL 3

    Author Comment

    Yes can put these lines in my .exe file, but can apache do this automatically?

    Featured Post

    Do You Know the 4 Main Threat Actor Types?

    Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

    Join & Write a Comment

    If your site has a few sections that need to be secure when data is transmitted between the server and local computer, such as a /order/ section for ordering or /customer/ which contains customer data, etc it would of course be recommended to secure…
    It is possible to boost certain documents at query time in Solr. Query time boosting can be a powerful resource for finding the most relevant and "best" content. Of course the more information you index, the more fields you will be able to use for y…
    This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor ( If you're looking for how to monitor bandwidth using netflow or packet s…
    In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor ( If you're interested in additional methods for monitoring bandwidt…

    746 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    17 Experts available now in Live!

    Get 1:1 Help Now