AEM调度员的奇怪行为:

AEM调度员的奇怪行为:,aem,sling,requestdispatcher,Aem,Sling,Requestdispatcher,我们将AEM 6.2与Dispatcher 4.2一起使用,在每次页面刷新后,缓存不会被考虑用于响应 存在由/auth\u checker保护并由/allowAuthorized缓存的安全内容。 内容的URL如下所示: 加载上面的页面时,它通过Ajax请求以下请求。 调度程序缓存上述两个URL结果 但是如果页面被刷新(sample.html),则只会从缓存中获取页面html(sample.html)。input.json将不会从缓存中提取,而是从发布服务器中提取 这是一致的,可以通过对另一个

我们将AEM 6.2与Dispatcher 4.2一起使用,在每次页面刷新后,缓存不会被考虑用于响应

存在由
/auth\u checker
保护并由
/allowAuthorized
缓存的安全内容。 内容的URL如下所示:

加载上面的页面时,它通过Ajax请求以下请求。

调度程序缓存上述两个URL结果

但是如果页面被刷新(sample.html),则只会从缓存中获取页面html(sample.html)。input.json将不会从缓存中提取,而是从发布服务器中提取

这是一致的,可以通过对另一个URL的另一个Ajax调用进行复制,如下所示。

但对(input.json)的后续请求将从缓存中提取,直到页面(sample.html)刷新为止

我们的设置详情如下:

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
[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
[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" - -
调度程序配置:

/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"
            }
        }
    }
}
URL的请求头:

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
[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
[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" - -
URL的响应头:

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
[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
[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" - -
每次页面刷新后的调度程序日志(不是从缓存):

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
[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
[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" - -
相同URL的第二个Ajax请求的调度程序日志(缓存响应):

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
[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
[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" - -

不确定您的问题是否正确,但我认为您已设置了
statfileslevel“1”
,这会使/content/sample下的所有内容在页面激活时过期。在这种情况下,页面不会被激活。仅使用页面刷新,该页面上的Ajax调用就不会第一次从缓存中获取。在没有刷新页面的情况下,第二次Ajax调用是从缓存中获取的。在我看来,配置工作正常,请注意,使用缓存响应时没有创建。请尝试以下操作,以确保发布是否每次都提供JSON服务。转到发布访问日志,执行Ajax请求,并确认是否记录了请求。第二个成功发布的XHR与第一个不同,它是如何发布的?那么请求头中的
Referer
是如何成为
.json
url的呢?就请求头和Referer而言,第二个请求与第一个请求没有什么不同。这只是页面刷新后第二次调用该URL(input.json)。