在我的Apache, 配置文件看起来像这个:
RewriteCond %{HTTP_REFERER} !^mysite.com [NC]
我建了一个iphone和ipad应用程序, 里面我放了一个搜索浏览器。
如何允许应用程序( 仅是我创建的应用程序) 的搜索浏览器访问图像?
在我的Apache, 配置文件看起来像这个:
RewriteCond %{HTTP_REFERER} !^mysite.com [NC]
我建了一个iphone和ipad应用程序, 里面我放了一个搜索浏览器。
如何允许应用程序( 仅是我创建的应用程序) 的搜索浏览器访问图像?
如果您正在使用 iOS UIWebView, 这可能是个解决方案 :
您将更改 WebView 发送的默认用户代理器( 我们在此将其更改为“ 唯一AppUserAgent ” ), 在程序启动时运行此代码一次
NSDictionary *dictionnary = [NSDictionary dictionaryWithObjectsAndKeys:@"UniqueAppUserAgent", @"UserAgent", nil];
[[NSUserDefaults standardUserDefaults] registerDefaults:dictionnary];
然后使用 {HTTP_USER_AUENT} 作为您的条件
RewriteCond %{HTTP_USER_AGENT} UniqueAppUserAgent
如果我正确理解您想要做什么, 您希望从您的应用程序中发送请求, 并指定 HTTP_ REFERERER, 以便激活您的缓存规则 。
您可以通过以下方式做到这一点:将 HTTP 请求分割到您的服务器上, 并在您的应用程序中显示 HTML 。 I. e.,
使用 NSURLConnction
获取 HTML 出服务器; 您可以在网络上找到许多使用 HTML 的例子, 在此我只想指出, 您可以为您的请求指定一个自定义页眉 :
NSMutableURLRequest* request = [[[NSMutableURLRequest alloc] initWithURL:url] autorelease];
[request setValue:@"mySite.com" forHTTPHeaderField:@"HTTP_REFERER"];
一旦您从请求中获得 HTML, 您就会在您的 UIWbView 中加载 HTMLString: (NSString *) string baseURL: (NSUR *) baseURL :
[webView loadHTMLString:myHtml baseURL:nil];
如果您提供您拥有的代码, 在任何情况下, 它会更容易帮助。
I am using CodeIgniter 1.7.2 with XAMPP 1.7.2 on a Windows computer. I am trying to make use of SimplePie. I followed all the instructions I could find: a copy of simplepie.inc is in my applications/...
I have an apache server running, with mongrels underneath running rails. The apache config file for my rails app looks like this: <VirtualHost *:80> ServerName trunk.production.charanga ...
I have developed over 50 sites that all use the exact same files other than CSS and IMAGES, I currently duplicate the files each time I create a new site and upload different css and images. What ...
I finish a litle http server, writing from scratch. I would like to be sure that my imlementation is conforme to the HTTP specifications. W3C give us tools for HTML/XML conformance, but i see nothing ...
I ve tried searching for this but it s pretty difficult to put into words. Basically, our site will run fine for most users without any issues. Sometimes though, those of us who use the site pretty ...
I would like to submit a form to a CGI script localy (w3c-markup-validator), but it is too slow using curl and apache, I want to use this CGI script more than 5,000 times in an another script. and ...
I am using curl like this: curl -s -F "uploaded_file=@/path_to_file;type=text/html" -F output=soap12 http://localhost/w3c-markup-validator/check >text.xml && xsltproc script/guilbep_soap_w3c....
I am serving my FastCGI application in Apache2 using the standalone FastCGI server and the FastCgiExternalServer directive. When I restart my FastCGI app my users get a 500 error. What can I do to ...