Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/lua/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Browser cache Grails2.3:缓存http标记以提供静态内容_Browser Cache_Cache Control_Static Content_Grails 2.3 - Fatal编程技术网

Browser cache Grails2.3:缓存http标记以提供静态内容

Browser cache Grails2.3:缓存http标记以提供静态内容,browser-cache,cache-control,static-content,grails-2.3,Browser Cache,Cache Control,Static Content,Grails 2.3,我们在Grails2.3.5中开发一个web应用程序 它由带有RESTAPI的web服务组成。Web UI是在ExtJS中开发的,并打包到Grails war文件中(在Web应用程序中) Web UI是通过加载一个静态index.html启动的,该静态index.html根据需要加载css、js文件和其他资源 静态资源在Config.groovy中配置: grails.resources.adhoc.patterns = ['/images/*', '/css/*', '/js/*', '/pl

我们在Grails2.3.5中开发一个web应用程序

它由带有RESTAPI的web服务组成。Web UI是在ExtJS中开发的,并打包到Grails war文件中(在Web应用程序中)

Web UI是通过加载一个静态index.html启动的,该静态index.html根据需要加载css、js文件和其他资源

静态资源在Config.groovy中配置:

grails.resources.adhoc.patterns = ['/images/*', '/css/*', '/js/*', '/plugins/*', '/spa/*', '/hds/*']
静态内容未在浏览器中正确缓存

我想将Grails配置为缓存服务器上未更新的静态文件,并在更改时强制更新

服务器上的文件是今天(2014-05-15)发布的

示例请求

GET /hdspro/static/hds/resources/js/versionInfo/versionInfo.js HTTP/1.1
Host: dev.healthdataspace.de
Connection: keep-alive
Cache-Control: max-age=0
Accept: */*
User-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/34.0.1847.137 Safari/537.36
Referer: https://dev.healthdataspace.de/hdspro/static/hds/index.html
Accept-Encoding: gzip,deflate,sdch
Accept-Language: sl,en-GB;q=0.8,en;q=0.6,de;q=0.4,en-US;q=0.2
Cookie: JSESSIONID=34C496D289B9CE68F31AE2AFD5031CB2
If-Modified-Since: Thu, 15 May 2014 13:00:42 GMT
答复:

HTTP/1.1 200 OK
Server: nginx/1.6.0
Date: Thu, 15 May 2014 14:15:29 GMT
Content-Type: application/javascript
Content-Length: 130
Connection: keep-alive
Last-Modified: Thu, 15 May 2014 13:00:42 GMT
即使缓存在浏览器中的文件与服务器上的文件相同,它还是被再次下载

我尝试使用缓存资源插件来实现这一点,但没有成功,因为所有文件都转换为哈希文件,加载失败

您有在Grails中缓存静态内容的经验吗


谢谢您的帮助。

我看一下,不要使用资源插件,而是使用grails资产管道插件,它将成为grails 2.4中的标准。它处理缓存和即时消化