iOS 6 and POST caching

Started by Hernan_Schmidt5 replies7 views
Hernan_SchmidtOriginal post
#1

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!

kvzTransloadit team
#3

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

Hernan_Schmidt
#4

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

Hernan_Schmidt
#5

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

kvzTransloadit team
#6

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

Kind regards,
Kevin