etag

Browser cache expiration for js and css files with wildfly

旧街凉风 提交于 2019-12-07 05:15:06
问题 I have a angularjs javascript app packaged in a webapp deployed to Wildfly 8.2.1. Sometimes, when I deploy javascript or css modifications to this webapp, users have to manually delete their browser cache for the modifications appear. Is there a way to change this behavior so users don't have to delete their browser cache every time? 回答1: I've shared a Gist article about that. It describes how to configure response headers in wildfly undertow subsytem to tune expiration cache headers in

ETags, IIS7, Kernel Cache Policy (enableKernelCache)

半腔热情 提交于 2019-12-07 04:38:12
问题 Two-part question (parts are closely related): with the default OOTB ETag policy that IIS7 employs, why don't we see the If-None-Match/304 interaction as we navigate through pages? The headers returned for an empty-cache request, for instance, are: Content-Type image/png Last-Modified Thu, 03 Dec 2009 15:51:56 GMT Accept-Ranges bytes Etag "a8a0628a3074ca1:0" Server Microsoft-IIS/7.0 X-Powered-By ASP.NET Date Tue, 22 Dec 2009 19:47:36 GMT Content-Length 1780 ...and yet subsequent accesses to

不使用cookie记录用户信息

孤人 提交于 2019-12-06 16:10:39
cookie是什么: cookie是由web服务器保存在用户浏览器(客户端)上的小文件,它可以包含用户信息,用户操作信息等等,无论何时访问服务器,只要同源,就能携带到服务端 常见方式 一般:请求一个接口,返回是否登录,如果登录成功,服务器(set-cookie)设置cookie到浏览器,以后请求api会继续请求 jwt:将用户id.payload.签证进行加密,并且注入到客户端cookie,之后每次请求会在服务端解析该cookie,并获取对应的用户数据,由于存在客户端,所以解放了服务端,减少服务端压力。也可以将该cookie放到根域名下,这样就可以登录一次,遍地开花。 可以看到,常见的方式都是利用cookie(或者浏览器storage),这样你的信息还是会被看到,如果别人获取到你的cookie也有办法进行破解甚至直接复制登录。那么有没有办法不借用cookie来记录用户信息的? 利用缓存存储用户信息 优点:安全可靠 缺点:依赖服务端 原理概述: 请求一个资源,如果设置cache-control、lastmodify、etag等,会进行缓存相关的判定: cache-control:是否强缓存,如果命中直接读取浏览器缓存的上次返回内容 last-modify:如果未命中强缓存,进行时间的判断,如果有if-modified-since并且和last-modify那么读取缓存

.htaccess not working - only caching images and not JS or CSS [duplicate]

◇◆丶佛笑我妖孽 提交于 2019-12-06 04:26:13
问题 This question already has answers here : Closed 10 years ago . Duplicate: Why isn’t my javascript & css caching ? I'm noticing that I'm only receiving 304 HTTP codes (cached content) for images but not JavaScript or CSS. My .htaccess file is: Options -Indexes Options +FollowSymLinks # Enable ETag FileETag MTime Size # Set expiration header ExpiresActive on ExpiresDefault "access plus 1 week" # Compress some text file types AddOutputFilterByType DEFLATE text/html text/plain text/css text/xml

Firefox & IE: Corrupted data when retrieved from cache

*爱你&永不变心* 提交于 2019-12-05 19:24:40
I have a request to the server which looks like this: http://localhost/Combine.aspx/flag/file1.js,file2.js,file3.js I have also tried this: http://localhost/Combine.aspx/flag/value/file1.js/file2.js/file3.js It simply combines the three files which it was given: this works fine. Upon the first request from Firefox, the page displays correctly. When the page is refreshed again, the content looks like this: ��������`I�%&/m�{J�J��t��`$�����iG#)�*��eVe]f@�흼��{���{��;�N' In that case, no request is made to the server, the file is only retrieved from the firefox cache, as far as I can tell. If I

TCP/IP基础总结性学习(6)

非 Y 不嫁゛ 提交于 2019-12-05 19:01:08
HTTP 首部 一. HTTP 报文首部 1.HTTP 报文的结构: 2.HTTP 请求报文 图示: 举例子: 3.HTTP 响应报文: 下面的示例是访问 http://hackr.jp 时,请求报文的首部信息: 以下示例是之前请求访问 http://hackr.jp/ 时,返回的响应报文的首部信息: 在报文众多的字段当中,HTTP 首部字段包含的信息最为丰富。首部字段同时存在于请求和响应报文内,并涵盖 HTTP 报文相关的内容信息。 二. HTTP 首部字段 1.HTTP 首部字段传递重要信息: HTTP 首部字段是构成 HTTP 报文的要素之一。在客户端与服务器之间以 HTTP 协议进行通信的过程中,无论是请求还是响应都会使用首部字段,它能起到传递额外重要信息的作用。使用首部字段是为了给浏览器和服务器提供报文主体大小、所使用的 语言、认证信息等内容。 图:首部字段内可使用的附加信息较多 2.HTTP 首部字段结构 : HTTP 首部字段是由首部字段名和字段值构成的,中间用冒号“:” 分 隔。 例如,在 HTTP 首部中以 Content-Type 这个字段来表示报文主体的对象类型。 就以上述示例来看,首部字段名为 Content-Type,字符串 text/html 是 字段值。 另外,字段值对应单个 HTTP 首部字段可以有多个值,如下所示。 注意:若 HTTP

ETag and If-None-Match HTTP Headers are not working

回眸只為那壹抹淺笑 提交于 2019-12-05 16:55:41
问题 I have a file in my webserver and I am downloading that to my app everytime I access it because its possible that file content might be changed But If it is changed I would like to download that time only so bandwidth can be saved and fortunately that's what this ETag and If-None-Match header fields are for. When I make a request first time ,I retrieve the ETag from the HTTP response headers In the subsequent requests to download that file I'd attach the Etag value for If-None-Match

Why responses to PUT requests MUST NOT provide an ETag?

◇◆丶佛笑我妖孽 提交于 2019-12-05 16:33:47
From Hypertext Transfer Protocol (HTTP/1.1): Semantics and Content : An origin server MUST NOT send a validator header field ( Section 7.2 ), such as an ETag or Last-Modified field, in a successful response to PUT unless the request's representation data was saved without any transformation applied to the body (i.e., the resource's new representation data is identical to the representation data received in the PUT request) and the validator field value reflects the new representation. This requirement allows a user agent to know when the representation body it has in memory remains current as

Apache + Etags -> returns 200 and send content instead of 304

左心房为你撑大大i 提交于 2019-12-05 16:18:09
I have this Apache conf that uses Etags: <VirtualHost *:8080> ServerName xxx.co SSLEngine On SSLProtocol all -SSLv2 SSLCipherSuite ALL:!ADH:!EXPORT:!SSLv2:RC4+RSA:+HIGH:+MEDIUM SSLCertificateFile /etc/apache2/xxx.crt SSLCertificateKeyFile /etc/apache2/xxx.key SSLCertificateChainFile /etc/apache2/sub.class1.server.ca.pem SSLCACertificateFile /etc/apache2/ca.pem SetEnvIf User-Agent ".*MSIE.*" nokeepalive ssl-unclean-shutdown ServerAdmin edward@xxx.co DocumentRoot /home/ubuntu/xxx-react/build/ Header set Access-Control-Allow-Origin "*" FileETag MTime Size </VirtualHost> I have this request

前端性能优化

故事扮演 提交于 2019-12-05 10:40:47
前端性能优化,目的是为什么?让用户有更友好的体验,让服务商节省可观的资源。 对优化方向进行分类,直接来看表: 优化方向 优化手段 请求数量 CSS Sprites,合并脚本和样式表 请求带宽 使用Gzip压缩传输文件,精简JS文件 缓存利用 使用http缓存,使用CDN,ajax,减少DNS查找 页面结构 样式表放顶部,脚本放底部 代码校验 避免CSS表达式,避免重定向 减少Repaint和Reflow 设置class,脱离文档流,减少dom操作 下面具体解释其中一些优化点: CDN Content Delivery Network 即内容分发网络,CDN把 内容分发 到距离用户近的缓存服务器,然后DNS托管(把DNS解析的地址改成CDN提供的),DNS服务器根据用户IP地址,将域名解析成相应节点的缓存服务器IP地址,实现 用户就近访问 ,提高网站渲染速度和性能。 减少repaint和reflow 回流与重绘 通过设置class的方式,而不是多次修改元素style属性。 有动画效果的元素可以将position属性设为fixed或absolute。 权衡速度的平滑性,函数节流(自己的理解) 减少对DOM元素的查询和修改,查询时可将其赋值给局部变量。 CSS引用 尽量使用link代替@import,因为link是在页面加载时同时加载,import是等页面加载完再加载。 有关缓存