简体   繁体   English

grails如何以etag 302状态发送并且每次都不加载js和其他资源?

[英]How in grails send with etag 302 status and not load js and other resource every time?

I add plugin 我添加插件

compile ":cache-headers:1.1.7"

and in config file next line: 并在配置文件的下一行:

cache.headers.enabled = false

now I'm sending this: 现在,我发送此:

Request URL:http://localhost:8080/SomeProject/js/pages/somePage.js?_=1444319608606
Request Method:GET
Status Code:200 OK
Response Headers
view source
Accept-Ranges:bytes
Content-Length:3757
Content-Type:application/javascript
Date:Thu, 08 Oct 2015 15:56:09 GMT
ETag:W/"3757-1432890402118"
Last-Modified:Fri, 29 May 2015 09:06:42 GMT
Server:Apache-Coyote/1.1
Request Headers
view source
Accept:text/javascript, application/javascript, application/ecmascript, application/x-ecmascript, */*; q=0.01
Accept-Encoding:gzip, deflate, sdch
Accept-Language:ru,en-US;q=0.8,en;q=0.6,en-GB;q=0.4
Connection:keep-alive
Cookie:JSESSIONID=80DE99527007982AF9016B65B20E05D2; _ga=GA1.1.494624836.1438596076
Host:localhost:8080
Referer:http://localhost:8080/SomeProject/
User-Agent:Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/45.0.2454.101 Safari/537.36
X-Requested-With:XMLHttpRequest
Query String Parameters
view source
view URL encoded
_:1444319608606

but how I understand in my request also should be: If-Modified-Since, If-None-Match and after refresh I should get 302 status but I always get status 200. 但是我在请求中的理解也应该是:If-Modified-Since,If-None-Match,刷新后我应该获得302状态,但我始终获得200状态。

You want a 304 status - 302 is a redirect. 您想要304状态-302是重定向。 But the cache-headers plugin isn't what you want, that's for controller responses. 但是cache-headers插件不是您想要的,而是用于控制器响应的。 The asset-pipeline plugin and its addon plugins manage caching, minification, etc. for static resources. asset-pipeline插件及其附加插件管理静态资源的缓存,缩小等。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM