I have a simple python cgi script: (my python is Python 3.9.21) #!venv/bin/python # " xxx " def main(): html = """ <!DOCTYPE html> <html> </html> """ print(html) exit(0) if __name__ == "__main__": main() When I access this using curl, I get this: $ curl -v http://.../gordo.py * Trying 10.1.31.11:80... * Connected to ... (10.1.31.11) port 80 (#0) > GET /gordo.py HTTP/1.1 > Host: ... > User-Agent: curl/7.76.1 > Accept: */* > * Mark bundle as not supporting multiuse < HTTP/1.1 200 OK < Date: Thu, 22 May 2025 03:11:21 GMT < Server: Apache/2.4.62 (CentOS Stream) OpenSSL/3.5.0 < Transfer-Encoding: chunked < Content-Type: text/html; charset=UTF-8 < <!DOCTYPE html> <html> </html> * Connection #0 to host ... left intact but when I change the xxx to the: #!venv/bin/python # " the " def main(): html = """ <!DOCTYPE html> <html> </html> """ print(html) exit(0) if __name__ == "__main__": main() I get this: $ curl -v http://.../gordo.py * Trying 10.1.31.11:80... * Connected to ... (10.1.31.11) port 80 (#0) > GET /gordo.py HTTP/1.1 > Host: ... > User-Agent: curl/7.76.1 > Accept: */* > * Mark bundle as not supporting multiuse < HTTP/1.1 200 OK < Date: Thu, 22 May 2025 03:18:58 GMT < Server: Apache/2.4.62 (CentOS Stream) OpenSSL/3.5.0 < Transfer-Encoding: chunked < Content-Type: text/plain; charset=UTF-8 < <!DOCTYPE html> <html> </html> * Connection #0 to host ... left intact Note that the Content-Type has changed from text/html to text/plain. I plan to manually set the Content-Type in my script, but I'd like to understand how a commented-out line changes how Apache guesses at the mimetype. Continue reading...