Apache2 "Response header name '<!--' contains invalid characters, aborting request"
The answers from @eorochena and @dogacan are special cases. In general:
You get this error if an exception is raised in a Python CGI script.
A good way of figuring out what went wrong is to invoke Python's CGI module debug helper function at the beginning of your CGI script like this:
cgitb.enable(display=0, logdir=OUTDIR)
where OUTDIR
is a directory name. If your CGI scripts raises some exception, then Apache puts an HTML file into that directory. The file has some garbage name such as tmpw4olz3xr.html
, and at its end it contains the Python stack trace enclosed within HTML comments (<!--
... -->
). This is the information that will help you fix the problem.
Notes:
- The
display=0
parameter means that the error details are not shown in the browser to your users. - You should probably comment out
cgitb.enable(...)
when you are sure your script works OK.