Is it possible to send a status code other than 200 via a python cgi script (such as 301 redirect)
2 Answers
via cgi script?
print "Status:301\nLocation: http://www.google.com"
3 Comments
Deepak Ingole
can you also post http request handler in this case/
Mike Howsden
Note also that this won't work if you're running your script via Python's built-in CGIHTTPServer stackoverflow.com/a/32079589/227651
Jiri
@MikeHowsden good point! It seems it is not possible to return status code with python built-in CGIHTTPServer. IMO it is major drawback because returning different status is very common even in quite simple webapps. Fortunately, other web server's behaviour is not the same.