If somebody accesses my server via http (i. e. not https) then I redirect GET requests to the https version.
But I don’t know what to do with POST and PUT because I cannot redirect them (the browser does a GET on redirect I believe).
I should return an error code. What HTTP error code should I return?
http://www.ietf.org/id/draft-ietf-httpbis-p2-semantics-18.txt explains HTTP response codes. If you want an error code, just return a 404 if requests cannot be serviced at that URL.