cache-control

Zend how to use cache component

那年仲夏 提交于 2019-11-29 04:15:58
问题 Let's say you have this scenario:a simple blog home-page that loads both static content as well as dynamic content. The static content is composed of images that rarely changes.I also have database-driven,dynamic content.The dynamic content consists in all of your blog posts (text and image) and related users comments.The dynamic content changes periodically from every hour to every day. How would you go with caching?And in particular supposing a user is leaving a comment or the admin is

Can I force .htaccess to refresh?

十年热恋 提交于 2019-11-29 02:53:39
We are moving a site from one CMS to another. The .htaccess file has been changed and it needs to be refreshed for the new site to work right. From what I understand the .htaccess file will only be refreshed if the browser cache is cleared? It is fine for those creating the site to clear our cache, but is there a way to get the users' browsers to get the new .htaccess file without the user clearing cache manually on his own initiative? Kai Noack If you're using RewriteRule, just use R instead of R=301. For other purposes, you'll have to clear your browser cache whenever you change a redirect.

HTTP头信息

耗尽温柔 提交于 2019-11-29 01:47:45
一、头信息解读 #HTTP的头域包括通用头、请求头、响应头和实体头四个部分。每个头域由一个域名,冒号和域值三部分组成。 #通用头部: 是客户端和服务器都可以使用的头部,可以在客户端、服务器和其他应用程序之间提供一些非常有用的通用功能,如Date头部。 #请求头部: 是请求报文特有的,它们为服务器提供了一些额外信息,比如客户端希望接收什么类型的数据,如Accept头部。 #响应头部: 便于客户端提供信息,比如,客服端在与哪种类型的服务器进行交互,如Server头部。 #实体头部: 指的是用于应对实体主体部分的头部,比如,可以用实体头部来说明实体主体部分的数据类型,如Content-Type头部。 1、HTTP通用头 #请求报文和响应报文两方都会使用的首部 2、HTTP请求头 #请求头用于说明是谁或什么在发送请求、请求源于何处,或者客户端的喜好及能力。服务器可以根据请求头部给出的客户端信息,试着为客户端提供更好的响应 3、HTTP响应头 #响应头向客户端提供一些额外信息,比如谁在发送响应、响应者的功能,甚至与响应相关的一些特殊指令。这些头部有助于客户端处理响应,并在将来发起更好的请求 4、HTTP实体头 #实体头部提供了有关实体及其内容的大量信息,从有关对象类型的信息,到能够对资源使用的各种有效的请求方法。总之,实体头部可以告知接收者它在对什么进行处理

What is the risk of having HTTP header “Cache-Control: public”?

青春壹個敷衍的年華 提交于 2019-11-29 00:20:01
问题 The Cache-Control HTTP/1.1 header can specify max-age as well as whether the cache content can be public or private, indicating whether intermediate cache can cache the content. For example, Ruby on Rails's expires_in() defaults to using Cache-Control: private What is the risk of making it public? If it is public, which extra places can cache the content -- would it be a proxy server, for example? What if the website is like Amazon.com, but the user is anonymous, then probably there is not

Understand If-Modified-Since HTTP Header

空扰寡人 提交于 2019-11-28 23:26:46
I am looking at a Caching library that is trying to use the If-Modified-Since header of a request object. The problem is this header never gets set, it is always blank which makes sense to me seeing how it is a REQUEST. How can you force a request to have a If-Modified-Since header? Or am I way off for what this does. Here is the function I am referring to. public function isNotModified(Request $request) { $lastModified = $request->headers->get('If-Modified-Since'); $notModified = false; if ($etags = $request->getEtags()) { $notModified = (in_array($this->getEtag(), $etags) || in_array('*',

Firebase hosting: How to prevent caching for the index.html of an SPA

微笑、不失礼 提交于 2019-11-28 21:25:15
I'm hosting an SPA on firebase where almost all paths get rewritten to index.html . I'm using webpack hash based cache busting, so I want to always prevent caching of my index.html but not any other files. I'm finding it surprisingly difficult to do so. Specifically, my file layout looks like this / ├── index.html ├── login.html ├── js │ ├── login.ba22ef2579d744b26c65.bundle.js │ └── main.6d0ef60e45ae7a11063c.bundle.js └── public └── favicon-16x16.ico I started naively with "sources": "index.html" before reading this quote from the docs. Each definition must have a source key that is matched

Max value for cache control header in HTTP

前提是你 提交于 2019-11-28 17:22:12
I'm using Amazon S3 to serve static assets for my website. I want to have browsers cache these assets for as long as possible. What meta-data headers should I include with my assets Cache-Control: max-age=??? Generally one year is advised as a standard max value. See RFC 2616 : To mark a response as "never expires," an origin server sends an Expires date approximately one year from the time the response is sent. HTTP/1.1 servers SHOULD NOT send Expires dates more than one year in the future. Although that applies to the older expires standard, it makes sense to apply to cache-control too in

Private vs Public in Cache-Control

给你一囗甜甜゛ 提交于 2019-11-28 15:36:47
Can you please describe an example indicating difference between Public and Private Cache-Control in asp.net applications hosted in IIS. I read in MSDN that the difference is the following: Public: Sets Cache-Control: public to specify that the response is cacheable by clients and shared (proxy) caches. Private: Default value. Sets Cache-Control: private to specify that the response is cacheable only on the client and not by shared (proxy server) caches. I am not sure I have completely understood the pros and cons from each choice. An example for when to or not to use it would be great. For

Http缓存策略

假装没事ソ 提交于 2019-11-28 15:33:17
浏览器一般缓存图片、 CSS 、 JS 等静态文件,因为这些文件的更新频率相对来说比较低,合理利用浏览器的缓存对网站的性能提升有很大帮助。 HTTP 缓存分为两部分,分别是本地缓存和缓存协商,当本地缓存不生效时会启用缓存协商。 HTTP 缓存主要由 HTTP 协议的头(Header)信息来制定。 本地缓存 本地缓存是指浏览器请求资源时命中了浏览器本地的缓存资源,浏览器并不会发送真正的请求给服务器了。它的执行过程是: 第一次浏览器发送请求给服务器时,此时浏览器还没有本地缓存副本,服务器返回资源给浏览器,响应码是200 OK,浏览器收到资源后,把资源和对应的响应头一起缓存下来。 第二次浏览器准备发送请求给服务器时候,浏览器会先检查上一次服务端返回的响应头信息中的Cache-Control,它的值是一个相对值,单位为秒,表示资源在客户端缓存的最大有效期,过期时间为第一次请求的时间减去Cache-Control的值,过期时间跟当前的请求时间比较,如果本地缓存资源没过期,那么命中缓存,不再请求服务器。 如果没有命中,浏览器就会把请求发送给服务器,进入缓存协商阶段。 与本地缓存相关的头有:Cache-Control、Expires,Cache-Control有多个可选值代表不同的意义,而Expires就是一个日期格式的绝对值。 Cache-Control Cache

Cached, PHP generated Thumbnails load slowly

谁说我不能喝 提交于 2019-11-28 15:18:38
Question Part A ▉ (100 bountys, awarded) Main question was how to make this site, load faster. First we needed to read these waterfalls. Thanks all for your suggestions on the waterfall readout analysis. Evident from the various waterfall graphs shown here is the main bottleneck: the PHP-generated thumbnails. The protocol-less jquery loading from CDN advised by David got my bounty, albeit making my site only 3% faster overall, and while not answering the site's main bottleneck. Time for for clarification of my question, and, another bounty: Question Part B ▉ (100 bountys, awarded) The new