我对静态文件缓存和TYPO3有一个奇怪的问题。它有效,但不是所有时间。在我识别的已交付页面的测试期间,并非每次都传递缓存的html。
然后我在不同的浏览器中进行了几次测试,这些浏览器从未登录过TYPO3后端。到处都是一样的。有些页面是缓存的,有些则没有。 即使我对同一页面发出多个请求,例如通过卷曲,有时我得到静态变体,有时TYPO3传递页面。但它不可复制。
我已经创建了一个小的shell脚本来为我自动执行此测试:
#!/bin/sh
url="https://domain.tld/foo/bar/"
for i in `seq 10`;
do
echo $i
curl -s $url | grep statically
done
预期的行为是在每个请求上获取静态页面,但现实看起来像这样:
➜ ~ ./test.sh
1
<!-- cached statically on: 14-12-16 08:46 -->
2
3
4
5
<!-- cached statically on: 14-12-16 08:46 -->
6
<!-- cached statically on: 14-12-16 08:46 -->
7
8
9
<!-- cached statically on: 14-12-16 08:46 -->
10
<!-- cached statically on: 14-12-16 08:46 -->
这就是访问日志的样子:
xx.xxx.xx.xx - 14/Dec/2016:11:52:44 +0100 GET /foo/bar/ HTTP/1.1 200 26892 - curl/7.43.0
xx.xxx.xx.xx - 14/Dec/2016:11:52:44 +0100 GET /foo/bar/ HTTP/1.1 200 26892 - curl/7.43.0
xx.xxx.xx.xx - 14/Dec/2016:11:52:43 +0100 GET /foo/bar/ HTTP/1.1 200 26892 - curl/7.43.0
xx.xxx.xx.xx - 14/Dec/2016:11:52:43 +0100 GET /foo/bar/ HTTP/1.1 200 26661 - curl/7.43.0
xx.xxx.xx.xx - 14/Dec/2016:11:52:43 +0100 GET /foo/bar/ HTTP/1.1 200 26661 - curl/7.43.0
xx.xxx.xx.xx - 14/Dec/2016:11:52:42 +0100 GET /foo/bar/ HTTP/1.1 200 26661 - curl/7.43.0
xx.xxx.xx.xx - 14/Dec/2016:11:52:42 +0100 GET /foo/bar/ HTTP/1.1 200 26661 - curl/7.43.0
xx.xxx.xx.xx - 14/Dec/2016:11:52:42 +0100 GET /foo/bar/ HTTP/1.1 200 26661 - curl/7.43.0
xx.xxx.xx.xx - 14/Dec/2016:11:52:42 +0100 GET /foo/bar/ HTTP/1.1 200 26892 - curl/7.43.0
xx.xxx.xx.xx - 14/Dec/2016:11:52:41 +0100 GET /foo/bar/ HTTP/1.1 200 26892 - curl/7.43.0
唯一的区别是传送内容的大小。
这是响应标头的样子。第一个是坏的,第二个是正确的:
➜ ~ curl -I https://domain.tld/foo/bar/
HTTP/1.1 200 OK
Date: Wed, 14 Dec 2016 12:14:17 GMT
Server: Apache/2.4.20
X-Powered-By: PHP/7.0.6
Content-Language: de
Content-Length: 21850
Strict-Transport-Security: max-age=31536000
Connection: close
Content-Type: text/html; charset=utf-8
➜ Downloads curl -I https://domain.tld/foo/bar/
HTTP/1.1 200 OK
Date: Wed, 14 Dec 2016 12:14:19 GMT
Server: Apache/2.4.20
Strict-Transport-Security: max-age=31536000
Vary: Host,Accept-Encoding
Last-Modified: Wed, 14 Dec 2016 07:46:38 GMT
Accept-Ranges: bytes
Content-Length: 21932
Cache-Control: max-age=38741
Expires: Wed, 14 Dec 2016 23:00:01 GMT
X-UA-Compatible: IE=edge
X-Content-Type-Options: nosniff
Connection: close
Content-Type: text/html; charset=utf-8
我的.htaccess文件包含mod_rewrite规则,可以在这里找到:
它基本上是TYPO3 7.6附带的默认.htacess文件和一些自定义添加。
由于托管是在托管服务器上完成的,因此无法访问vhost配置以启用RewriteLog。
我现在正在寻找提示我可以做些什么来进一步追查问题。