1
votes

I have an apache server that I am using for cgi. I am writing my cgis in Python.

As long as my responses are of the form "Content-Type: text/html\n #" it works.

But if I send anything else, I get a 500 error and my logs say "malformed header from script. Bad header" Can I change my configurations to make it work? Is there anything else I can do?

2

2 Answers

4
votes

As with all CGI, you need a blank line between the headers and the body.

print 'Content-Type: text/plain'
print
print 'Hello, World!'
1
votes

You need to send a Content-Type header to tell the browser what type of data you're sending it. Without that you'll get the 500 error you're experiencing.