Caching tunneled URL responses

Apps that access enterprise servers using NSURLSession can use AppTunnel with HTTP/S tunneling, as described in AppTunnel. By default, for a tunneled URL request:

The data for the URL is reloaded from the originating source. Any existing locally cached response is ignored.
The data in the response is not stored in the local cache.

The reason that AppTunnel with HTTP/S tunneling does not use locally cached responses is to avoid caching sensitive enterprise server data on the device.

However, some apps have requirements to use locally cached responses. Some examples are:

The app requires a response even when the device has no network connectivity.
The app requires a customized response.

If your app requires locally cached responses for URL requests that use AppTunnel with HTTP/S tunneling, use the following method, which is on the AppConnect singleton object:

 

-(void)allowLocalCachingForTunneledRequests:(BOOL)flag;

The value of flag has the following impact:

true

Allows caching for requests and responses that use AppTunnel with HTTP/S tunneling. However, whether caching actually occurs depends on the cache policy for the NSURLRequest.

false

Clears all cached responses, including responses for URL requests not using AppTunnel with HTTP/S tunneling.

IMPORTANT: Do not cache sensitive data.