How To Set Http Headers With Different Content Type
I have a webpage dynamically created via Python. Its purpose is to provide images, so the first line sets the content type: Content-Type: image/png I would like to set http header
Solution 1:
Cache-Control, Content-Type and the like are HTTP headers, not "html style headers". You can use them regardless of the content-type.
Solution 2:
import string, sys, math, osprint("Cache-Control: max-age=" + str(86400 * 3650) + ", public")
print("Content-Type: image/png")
print("\n")
That sets the resource to expire in ten years.
Post a Comment for "How To Set Http Headers With Different Content Type"