iOS 6 and POST caching

Archived from the Transloadit support forum. Originally posted on March 14, 2013; details may be outdated, see our docs for current behavior. Original thread

Hi,
We are using Transloadit to upload photos in our web app, and we are having difficulties with iOS 6, which now supports accessing the camera or gallery from Safari.
We are using a jQuery AJAX request with the images sent as attachments in a FormData object.
What happens is that users upload one photo OK, but when they try to upload a second one, the request doesn’t really finish and we get a response pointing to the first photo.
From my research, I believe the problem is that Safari is caching POST requests, so it doesn’t send the second photo. It seems that the server should be responding with certain cache headers in order to force Safari to post the image:
http://stackoverflow.com/questions/14762675/jquery-upload-pdf-with-formdata
http://core.trac.wordpress.org/ticket/22552

I also tried adding headers: { “cache-control”: “no-cache”} to the AJAX request, but that silently fails, I have no idea why.

Would it be possible to add these headers to Transloadit? Or is there a different workaround?

Thanks!

Hey Hernan,

Very sorry for the late reply.
We did some research and also found this http://stackoverflow.com/questions/12506897/is-safari-on-ios-6-caching-ajax-results.

So it seems you are not alone.
We’re going to look into implementing Cache-Control: no-cache and get back to you today.

Kind regards,
Kevin

Hello Hernan,

We now add the Cache-Control: no-cache header to all API communication.
Please let me know if this works out for you, and if you have any additional questions!

Kind regards,
Kevin

Hi Kevin,
Wow thanks for the quick fix! We’ll do some testing and let you know how it goes.
The link to SO you posted looks like such an easy solution – why didn’t I think of it!

Thanks again,
Hernan

Hi Kevin,
So we’ve tested the fix, and the issue is solved!
Thanks a lot for the quick response!
Hernán

Awesome Hernán,
Be sure to let us know if we can ever do anything else for you!

Kind regards,
Kevin