no-cache

Laravel response Cache-Control headers always containing 'no-cache'

十年热恋 提交于 2019-12-04 00:37:07
For some reason Laravel seems to be manipulating the response headers 'Cache-Control' on the very last moment. I want to make browser caching possible. class TestController extends Controller { public function getTest() { $response = new \Illuminate\Http\Response('test', 200, array( 'Cache-Control' => 'max-age='.(config('imagecache.lifetime')*60).', public', 'Content-Length' => strlen('test'), )); $response->setLastModified(new \DateTime('now')); $response->setExpires(\Carbon\Carbon::now()->addMinutes(config('imagecache.lifetime'))); return $response; } } Even when I use a 'after-middleware'

Set response header in Spring Boot

百般思念 提交于 2019-12-01 12:37:33
How can I set the response header for each call in my application made with Spring Boot? I would like to try to use a filter to intercept all the calls and be able to set the response header. I followed the guide Disable browser caching HTML5 , but only set the request header, and not always. There are three ways to do this: Set the response for a specific controller, in the Controller class: @Controller @RequestMapping(value = DEFAULT_ADMIN_URL + "/xxx/") public class XxxController .... @ModelAttribute public void setResponseHeader(HttpServletResponse response) { response.setHeader("Cache

Set response header in Spring Boot

余生颓废 提交于 2019-12-01 09:55:52
问题 How can I set the response header for each call in my application made with Spring Boot? I would like to try to use a filter to intercept all the calls and be able to set the response header. I followed the guide Disable browser caching HTML5, but only set the request header, and not always. 回答1: There are three ways to do this: Set the response for a specific controller, in the Controller class: @Controller @RequestMapping(value = DEFAULT_ADMIN_URL + "/xxx/") public class XxxController ....

Avoiding 301 redirect caching

不羁岁月 提交于 2019-11-30 17:41:35
This is a follow up question to Using 301/303/307 redirects for dynamic short urls , where I try to determine the best method for implementing short url redirection when the destination url will change on a frequent basis. While it seems that 301 and 307 redirects both perform the same way, the issue that concerns me is 301 redirect caching (as documented here )- is the best way to avoid this to use 307 redirects instead (I'm assuming 307 redirects will never cache?), or to explicitly send a no-cache header ("Cache-Control: no-cache, must-revalidate")? Don't try to avoid 301 caching. If you

How long does Google Chrome cache a resource if expires and/or no-cache headers are not set?

♀尐吖头ヾ 提交于 2019-11-30 06:04:24
We have been having a problem with Chrome caching a resource on our Glassfish server. The expires and no-cache headers are not being sent and the resource (an approximately 4 MB SWF file) is being cached by Chrome -- despite the presence of the Last-Modified header. Sometimes Chrome will get a 304 code, and other times it simply does a 200 (from cache). I understand the 304 -- Chrome is likely checking the most recent Last-Modified date with the cached version to decide. But other times it does the 200 (from cache), which does not return any header information and appears that Chrome is simply

Avoiding 301 redirect caching

允我心安 提交于 2019-11-30 01:15:18
问题 This is a follow up question to Using 301/303/307 redirects for dynamic short urls, where I try to determine the best method for implementing short url redirection when the destination url will change on a frequent basis. While it seems that 301 and 307 redirects both perform the same way, the issue that concerns me is 301 redirect caching (as documented here)- is the best way to avoid this to use 307 redirects instead (I'm assuming 307 redirects will never cache?), or to explicitly send a no

Howto deactivate caching inside a jsp page

折月煮酒 提交于 2019-11-28 04:52:44
问题 I understand there is a HTTP response header directive to disable page caching: Cache-Control:no-cache I can modify the header by "hand": <%response.addHeader("Cache-Control","no-cache");%> But is there a "nice" way to make the JSP interpreter return this header line in the server response? (I checked the <%@page ...%> directive. It seems there is nothing like that.) 回答1: Also add response.addHeader("Expires","-1"); response.addHeader("Pragma","no-cache"); to your headers and give that a shot

How to prevent Android from returning a cached response to my HTTP Request?

主宰稳场 提交于 2019-11-27 12:22:47
I'm writing a client that is making repeated http requests for xml data that is changing over time. It looks like the Android stack is caching my page requests and returning the same page repeatedly. How do I make sure it gets a fresh page each time? -- code --- HttpClient client = new DefaultHttpClient(); HttpGet request = new HttpGet(url); HttpResponse response; response = client.execute(request); InputStream in; in = response.getEntity().getContent(); BufferedReader reader = new BufferedReader(new InputStreamReader(in)); Thanks, Gerry Kylar add a HTTP header: Cache-Control: no-cache and see

Why both no-cache and no-store should be used in HTTP response?

人盡茶涼 提交于 2019-11-26 16:59:45
I'm told to prevent user-info leaking, only "no-cache" in response is not enough. "no-store" is also necessary. Cache-Control: no-cache, no-store After reading this spec http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html , I'm still not quite sure why. My current understanding is that it is just for intermediate cache server. Even if "no-cache" is in response, intermediate cache server can still save the content to non-volatile storage. The intermediate cache server will decide whether using the saved content for following request. However, if "no-store" is in the response, the

How to prevent Android from returning a cached response to my HTTP Request?

人走茶凉 提交于 2019-11-26 15:59:10
问题 I'm writing a client that is making repeated http requests for xml data that is changing over time. It looks like the Android stack is caching my page requests and returning the same page repeatedly. How do I make sure it gets a fresh page each time? -- code --- HttpClient client = new DefaultHttpClient(); HttpGet request = new HttpGet(url); HttpResponse response; response = client.execute(request); InputStream in; in = response.getEntity().getContent(); BufferedReader reader = new