RewriteCond from iphone / ipad app

In my apache, the configuration file looks like this:

RewriteCond %{HTTP_REFERER} !^mysite.com [NC]

I am creating an iphone and ipad application, and inside I put the Safari browser.

How to allow Safari browser application (only the application that I created) to access the image?

+3
source share
2 answers

If you are using iOS UIWebView, this might be the solution:

You change the default user agent (here we change it to "UniqueAppUserAgent") sent by WebView by running this code once when your application starts

NSDictionary *dictionnary = [NSDictionary dictionaryWithObjectsAndKeys:@"UniqueAppUserAgent", @"UserAgent", nil];
[[NSUserDefaults standardUserDefaults] registerDefaults:dictionnary];  

Then use% {HTTP_USER_AGENT} as your condition

RewriteCond %{HTTP_USER_AGENT} UniqueAppUserAgent
+2
source

, , HTTP_REFERER, apache.

, HTTP- HTML . .

  • HTML NSURLConnection; , , :

     NSMutableURLRequest* request = [[[NSMutableURLRequest alloc] initWithURL:url] autorelease];
     [request setValue:@"mySite.com" forHTTPHeaderField:@"HTTP_REFERER"];
    
  • HTML- , UIWebView - (void)loadHTMLString:(NSString *)string baseURL:(NSURL *)baseURL:

    [webView loadHTMLString:myHtml baseURL:nil];
    

, , .

+2

All Articles