Edit
The problem had nothing to do with the http header. It was a variable that was called in the cgi/python script before it was defined. Just in case others also try to work with an error message like that but can't find the reason for it.
I have inherited a website based on apache2/python/cgi scripts that I'm trying to maintain, but sometimes I'm struggling with really unhelpful errors. In this case, I get The server encountered an internal error or misconfiguration and was unable to complete your request. when clicking on an element on a page. The error log gives me the following information:
[Fri Jul 28 14:11:15.150877 2017] [http:error] [pid 1727] [client 193.174.111.250:53426] AH02429: Response header name '<!--' contains invalid characters, aborting request
Based on a similar question, I'm assuming the error is quite new, but I can't find the problem. Especially since the link / the script name stays the same. It works when first opening the site, but then stops working when I click something which does not refer me to a different site/script. How can that be the header's fault?
Just in case, here is the code that generates the beginning of the web page:
Code = "Content-Type: text/html\n\n"
Code += "<!DOCTYPE HTML PUBLIC '-//W3C//DTD HTML 4.0 Transitional//EN'>\n<html>\n"
Code += "<head>\n <title>BACTOME: RELATIVE EXPRESSIONS</title>\n"
...
As far as I understand now, the first line constitutes the only HTTP header I have. There is no '<!--' as stated in the error log. Does the header need anything else to be functional?
PS: Alternatively, if there's any easy way to turn these generic errors into more verbose ones, I'd also be very interested in that.