When trying to perform iOS device registration using POST against (e.g. OpenShift http://secure-pushee.rhcloud.com) that redirects to 'https' the client fails to redirect to the secure endpoint as defined in the 'Location:' header returned by the initial response. Instead it transforms the POST request to a GET, erasing the POST parameters, and then re-attemps the request against the insecure endpoint.
This is the default 'erroneous' behaviour for POST requests against 302-redirected endpoints that most user-agents follow. See RFC 2616 (section 10.3.3) and related blog post here.
We need to 'override' that 'default' behaviour by adding a 'setRedirectResponseBlock' on the Operation class which will return the original attempted NSURLRequest with the URL parameter updated to point to the new 'Location' header.
|