我们正在使用AEM 6.2与Dispatcher 4.2和 在每次刷新缓存后不考虑响应 。
安全内容由/auth_checker
保护并由/allowAuthorized
缓存。
内容的URL如下,
https://www.securedcontent.com/content/sample.html
在加载上述页面时,它会根据请求通过Ajax请求。 https://www.securedcontent.com/content/sample/some.query.json/sample/input.json
以上网址结果都会被调度程序缓存。
但是如果刷新页面(sample.html),则只会从缓存中获取页面html(sample.html)。 input.json不会从缓存中获取,而是从发布服务器获取。
这是一致的,可以通过对另一个URL的另一个Ajax调用来重现,如下所示。 https://www.securedcontent.com/content/sample/some.query.json/sample/another/input.json
但是对(input.json)的后续请求将从缓存中获取,直到页面(sample.html)被刷新。
我们的设置详情如下:
调度程序配置:
/aemsecuredcontent
{
/auth_checker
{
/url "/bin/permissioncheck"
/filter
{
/0000
{
/glob "*"
/type "deny"
}
/0001
{
/glob "/content/securedcontent/*"
/type "allow"
}
}
/headers
{
/0000
{
/glob "*"
/type "deny"
}
/0001
{
/glob "Set-Cookie:*"
/type "allow"
}
}
}
/clientheaders{ "*" }
/filter
{
/2401 { /type "deny" /glob "*" }
/2417 { /type "allow" /glob "*query.json*" }
}
/cache
{
/statfileslevel "1"
/allowAuthorized "1"
/rules
{
/0000
{
/type "allow" /glob "*"
}
/0001
{
/glob "*.nocache.html*"
/type "deny"
}
}
/invalidate
{
/0000
{
/glob "*"
/type "deny"
}
/0001
{
/glob "*.html"
/type "allow"
}
}
}
}
请求网址标题:
Accept: */*
Accept-Encoding: gzip, deflate, br
Accept-Language: en-US,en;q=0.9
Cache-Control: no-cache
Connection: keep-alive
Cookie: WT_FPC=id=39823rjfngfeihe9jwe; JSESSIONID=sjerht93qu4fg; login-token=48039qi4ig4joacrx.default
Host: www.securedcontent.com
Pragma: no-cache
Referer: https://www.securedcontent.com/content/sample.query.json/sample/input.json
User-Agent: Mozilla/5.0 (Windows NT 6.3; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/66.0.3359.181 Safari/537.36
X-Requested-With: XMLHttpRequest
网址的响应标题:
Accept-Ranges: bytes
Cache-Control: max-age=2592000
Connection: Keep-Alive
Content-Encoding: gzip
Content-Length: 8303
Content-Type: application/json
Date: Thu, 24 May 2018 06:53:12 GMT
Expires: Sat, 23 Jun 2018 06:53:12 GMT
Keep-Alive: timeout=5, max=98
Proxy-Server: something-proxywcm
Server: Apache
Strict-Transport-Security: max-age=31536000; includeSubDomains
Vary: Accept-Encoding
X-Content-Type-Options: nosniff
X-Frame-Options: SAMEORIGIN
X-UA-Compatible: IE=edge
X-XSS-Protection: 1; mode=block
Dispatcher每次刷新页面后记录(不是来自缓存):
[D] [pid 23365 (tid 139886375950080)] checking [/cache-dir/content/sample.query.json/sample/input.json]
[D] [pid 23365 (tid 139886375950080)] cachefile does not exist: /cache-dir/content/sample.query.json/sample/input.json
[D] [pid 23365 (tid 139886375950080)] try to create new cachefile: /cache-dir/content/sample.query.json/sample/input.json
[D] [pid 23365 (tid 139886375950080)] cache-action for [/cache-dir/content/sample.query.json/sample/input.json]: CREATE
Dispatcher记录同一URL的第二个Ajax请求(缓存响应):
[D] [pid 23365 (tid 139886302521088)] checking [/cache-dir/content/sample.query.json/sample/input.json]
[D] [pid 23365 (tid 139886302521088)] Authorization checker: connected to backend rend01
[D] [pid 23365 (tid 139886302521088)] cache-action for [/cache-dir/content/sample.query.json/sample/input.json]
[I] [pid 23365 (tid 139886302521088)] "GET /cache-dir/content/sample.query.json/sample/input.json" - -