[英]Adobe Experience Manager (AEM), Dispatcher Invalidation Issue: DAM Assets Not Invalidated/Evicted From Cache but Pages Are
我們有一個多站點 AEM 6.5.13 系統,前端帶有調度程序 4.3.4。
每個站點都有自己對應的 site[1-4]-dispatcher.any 文件(使用農場)。 每個站點的 /docroot 與每個站點的 VirtualHost 配置中聲明的內容相匹配。
還有一個包含以下內容的 invalidation_only.any 文件:
/virtualhosts { "invalidation_only" "dev.dispatcher.foo.com" }
/filter {
/0001 { /type "deny" /glob "*" }
/0002 { /type "allow" /glob "*/content*" }
/cache {
/docroot "/apps/cache/content"
invalidation_only.any 對應的 VirtualHost 有這個:
<VirtualHost *:80>
ServerName dev.dispatcher.foo.com
DocumentRoot /apps/cache/content
<LocationMatch "^/dispatcher/invalidate.cache$">
# domain A
SetEnvIf CQ-Path ".*/content/site1/.*" FLUSH_HOST=dev.site1.foo.com
RequestHeader set Host %{FLUSH_HOST}e env=FLUSH_HOST
# domain B
SetEnvIf CQ-Path ".*/content/site2/.*" FLUSH_HOST=dev.site2.foo.com
RequestHeader set Host %{FLUSH_HOST}e env=FLUSH_HOST
# domain C
SetEnvIf CQ-Path ".*/content/site3/.*" FLUSH_HOST=dev.site3.foo.com
RequestHeader set Host %{FLUSH_HOST}e env=FLUSH_HOST
# domain D
SetEnvIf CQ-Path ".*/content/site4/.*" FLUSH_HOST=dev.site4.foo.com
RequestHeader set Host %{FLUSH_HOST}e env=FLUSH_HOST
</LocationMatch>
<LocationMatch "^/invalidation_only/dispatcher/invalidate.cache$">
# domain A
SetEnvIf CQ-Path ".*/content/site1/.*" FLUSH_HOST=dev.site1.foo.com
RequestHeader set Host %{FLUSH_HOST}e env=FLUSH_HOST
# domain B
SetEnvIf CQ-Path ".*/content/site2/.*" FLUSH_HOST=dev.site2.foo.com
RequestHeader set Host %{FLUSH_HOST}e env=FLUSH_HOST
# domain C
SetEnvIf CQ-Path ".*/content/site3/.*" FLUSH_HOST=dev.site3.foo.com
RequestHeader set Host %{FLUSH_HOST}e env=FLUSH_HOST
# domain D
SetEnvIf CQ-Path ".*/content/site4/.*" FLUSH_HOST=dev.site4.foo.com
RequestHeader set Host %{FLUSH_HOST}e env=FLUSH_HOST
</LocationMatch>
</VirtualHost>
頁面正確失效,DAM資產沒有。
下面的 dispatcher.log 顯示了 test.jpg(site1 圖像)的激活。 我用更新的 test.jpg 圖像替換了現有的 test.jpg。
[Sat Aug 06 11:54:09 2022] [D] [pid 2132227:tid 139968756315904] Found farm farm_flush for dev.dispatcher.foo.com
[Sat Aug 06 11:54:09 2022] [D] [pid 2132227:tid 139968756315904] checking [/invalidation_only/dispatcher/invalidate.cache]
[Sat Aug 06 11:54:09 2022] [I] [pid 2132227:tid 139968756315904] Activation detected: action=Activate [/content/dam/site1/photos/Art/TEST/test.jpg]
[Sat Aug 06 11:54:09 2022] [I] [pid 2132227:tid 139968756315904] Touched /apps/cache/content/.stat
[Sat Aug 06 11:54:09 2022] [D] [pid 2132227:tid 139968756315904] response.status = 200
[Sat Aug 06 11:54:09 2022] [D] [pid 2132227:tid 139968756315904] response.headers[Server] = "Communique/2.6.3 (build 5221)"
[Sat Aug 06 11:54:09 2022] [D] [pid 2132227:tid 139968756315904] response.headers[Content-Type] = "text/html"
[Sat Aug 06 11:54:09 2022] [D] [pid 2132227:tid 139968756315904] cache flushed
[Sat Aug 06 11:54:09 2022] [I] [pid 2132227:tid 139968756315904] "POST /invalidation_only/dispatcher/invalidate.cache" 200 purge [farm_flush/-] 1ms
可以直接在發布服務器上看到新圖像,但通過調度程序,舊圖像仍然存在。 下面的 dispatcher.log 顯示的是 DELIVER 而不是 Evicted:(
[Sat Aug 06 11:54:27 2022] [D] [pid 2132227:tid 139968588527360] Found farm dev_foo_com for dev.foo.com
[Sat Aug 06 11:54:27 2022] [D] [pid 2132227:tid 139968588527360] checking [/content/dam/site1/photos/Art/TEST/test.jpg]
[Sat Aug 06 11:54:27 2022] [D] [pid 2132227:tid 139968588527360] cache-action for [/content/dam/site1/photos/Art/TEST/test.jpg]: DELIVER
[Sat Aug 06 11:54:27 2022] [D] [pid 2132227:tid 139968588527360] request declined
[Sat Aug 06 11:54:27 2022] [D] [pid 2132227:tid 139968588527360] response.headers[Content-Type] = "image/jpeg"
[Sat Aug 06 11:54:27 2022] [D] [pid 2132227:tid 139968588527360] response.headers[Last-Modified] = "Sat, 06 Aug 2022 15:12:46 GMT"
[Sat Aug 06 11:54:27 2022] [D] [pid 2132227:tid 139968588527360] response.headers[X-Content-Type-Options] = "nosniff"
[Sat Aug 06 11:54:27 2022] [I] [pid 2132227:tid 139968588527360] "GET /content/dam/site1/photos/Art/TEST/test.jpg" - hit [dev_foo_com/-] 0ms
我想知道以下是否是一個線索:
[Sat Aug 06 11:54:09 2022] [I] [pid 2132227:tid 139968756315904] Touched /apps/cache/content/.stat
/apps/cache/content
是緩存根目錄,但它並不特定於有問題的 site1 test.jpg。 激活 site1 頁面時,會特別提到在相關的 site1 緩存路徑中創建的 .stat 文件。
此外,“找到的農場”與 site1 無關,它的頁面在哪里?!
我懷疑 invalidation_only VirtualHost 可能需要注意,和/或可能與復制代理相關,但我不確定從哪里開始。
刷新代理位於發布實例上。 它在作者上配置並激活。 我相信我們的配置基於以下說明:
還有一些來自這里:
這是一個調度程序日志序列,顯示了對 site1 頁面的調用,對該頁面進行編輯並發布,再次調用現在編輯的頁面並顯示舊內容的成功驅逐/失效。
通過未編輯和緩存頁面的調度程序進行初始調用:
[Sat Aug 06 12:22:05 2022] [D] [pid 2136893:tid 139967800006400] Found farm dev_site1_foo_com for dev.site1.foo.com
[Sat Aug 06 12:22:05 2022] [D] [pid 2136893:tid 139967800006400] checking [/content/site1/en/test_pages/general.html]
[Sat Aug 06 12:22:05 2022] [D] [pid 2136893:tid 139967800006400] cache file is newer than lastflush -> use cache [/apps/cache/content/site1/content/site1/en/test_pages/general.html]
[Sat Aug 06 12:22:05 2022] [D] [pid 2136893:tid 139967800006400] cache-action for [/content/site1/en/test_pages/general.html]: DELIVER
[Sat Aug 06 12:22:05 2022] [D] [pid 2136893:tid 139967800006400] request declined
[Sat Aug 06 12:22:05 2022] [D] [pid 2136893:tid 139967800006400] response.headers[Content-Type] = "text/html;charset=utf-8"
[Sat Aug 06 12:22:05 2022] [D] [pid 2136893:tid 139967800006400] response.headers[X-Content-Type-Options] = "nosniff"
[Sat Aug 06 12:22:05 2022] [I] [pid 2136893:tid 139967800006400] "GET /content/site1/en/test_pages/general.html" - hit [dev_site1_foo_com/-] 1ms
發布帶有編輯的同一頁面:
[Sat Aug 06 12:23:38 2022] [D] [pid 2136893:tid 139968890533632] Found farm dev_site1_foo_com for dev.site1.foo.com
[Sat Aug 06 12:23:38 2022] [D] [pid 2136893:tid 139968890533632] checking [/invalidation_only/dispatcher/invalidate.cache]
[Sat Aug 06 12:23:38 2022] [I] [pid 2136893:tid 139968890533632] Activation detected: action=Activate [/content/site1/en/test_pages/general]
[Sat Aug 06 12:23:38 2022] [I] [pid 2136893:tid 139968890533632] Touched /apps/cache/content/site1/.stat
[Sat Aug 06 12:23:38 2022] [I] [pid 2136893:tid 139968890533632] Touched /apps/cache/content/site1/content/.stat
[Sat Aug 06 12:23:38 2022] [I] [pid 2136893:tid 139968890533632] Touched /apps/cache/content/site1/content/site1/.stat
[Sat Aug 06 12:23:38 2022] [I] [pid 2136893:tid 139968890533632] Touched /apps/cache/content/site1/content/site1/en/.stat
[Sat Aug 06 12:23:38 2022] [I] [pid 2136893:tid 139968890533632] Touched /apps/cache/content/site1/content/site1/en/test_pages/.stat
[Sat Aug 06 12:23:38 2022] [I] [pid 2136893:tid 139968890533632] Evicted /apps/cache/content/site1/content/site1/en/test_pages/general.html.h
[Sat Aug 06 12:23:38 2022] [I] [pid 2136893:tid 139968890533632] Evicted /apps/cache/content/site1/content/site1/en/test_pages/general.html
[Sat Aug 06 12:23:38 2022] [D] [pid 2136893:tid 139968890533632] response.status = 200
[Sat Aug 06 12:23:38 2022] [D] [pid 2136893:tid 139968890533632] response.headers[Server] = "Communique/2.6.3 (build 5221)"
[Sat Aug 06 12:23:38 2022] [D] [pid 2136893:tid 139968890533632] response.headers[Content-Type] = "text/html"
[Sat Aug 06 12:23:38 2022] [D] [pid 2136893:tid 139968890533632] cache flushed
[Sat Aug 06 12:23:38 2022] [I] [pid 2136893:tid 139968890533632] "POST /invalidation_only/dispatcher/invalidate.cache" 200 purge [dev_site1_foo_com/-] 1ms
[Sat Aug 06 12:23:38 2022] [D] [pid 2136893:tid 139968060049152] Found farm dev_site1_foo_com for dev.site1.foo.com
[Sat Aug 06 12:23:38 2022] [D] [pid 2136893:tid 139968060049152] checking [/invalidation_only/dispatcher/invalidate.cache]
[Sat Aug 06 12:23:38 2022] [I] [pid 2136893:tid 139968060049152] Activation detected: action=Activate [/content/site1/en/test_pages/general]
[Sat Aug 06 12:23:38 2022] [I] [pid 2136893:tid 139968060049152] Touched /apps/cache/content/site1/.stat
[Sat Aug 06 12:23:38 2022] [I] [pid 2136893:tid 139968060049152] Touched /apps/cache/content/site1/content/.stat
[Sat Aug 06 12:23:38 2022] [I] [pid 2136893:tid 139968060049152] Touched /apps/cache/content/site1/content/site1/.stat
[Sat Aug 06 12:23:38 2022] [I] [pid 2136893:tid 139968060049152] Touched /apps/cache/content/site1/content/site1/en/.stat
[Sat Aug 06 12:23:38 2022] [I] [pid 2136893:tid 139968060049152] Touched /apps/cache/content/site1/content/site1/en/test_pages/.stat
[Sat Aug 06 12:23:38 2022] [D] [pid 2136893:tid 139968060049152] response.status = 200
[Sat Aug 06 12:23:38 2022] [D] [pid 2136893:tid 139968060049152] response.headers[Server] = "Communique/2.6.3 (build 5221)"
[Sat Aug 06 12:23:38 2022] [D] [pid 2136893:tid 139968060049152] response.headers[Content-Type] = "text/html"
[Sat Aug 06 12:23:38 2022] [D] [pid 2136893:tid 139968060049152] cache flushed
[Sat Aug 06 12:23:38 2022] [I] [pid 2136893:tid 139968060049152] "POST /invalidation_only/dispatcher/invalidate.cache" 200 purge [dev_site1_foo_com/-] 1ms
通過調度程序調用編輯的頁面(顯示失效):
[Sat Aug 06 12:23:58 2022] [D] [pid 2136893:tid 139968756315904] checking [/content/site1/en/test_pages/general.html]
[Sat Aug 06 12:23:58 2022] [D] [pid 2136893:tid 139968756315904] cachefile does not exist: /apps/cache/content/site1/content/site1/en/test_pages/general.html
[Sat Aug 06 12:23:58 2022] [D] [pid 2136893:tid 139968756315904] try to create new cachefile: /apps/cache/content/site1/content/site1/en/test_pages/general.html
[Sat Aug 06 12:23:58 2022] [D] [pid 2136893:tid 139968756315904] cache-action for [/content/site1/en/test_pages/general.html]: CREATE
[Sat Aug 06 12:23:58 2022] [D] [pid 2136893:tid 139968756315904] Dropping socket after 114 seconds of inactivity: pub.foo.com:4503
[Sat Aug 06 12:23:58 2022] [D] [pid 2136893:tid 139968756315904] Creating new connection: pub.foo.com:4503
[Sat Aug 06 12:23:58 2022] [D] [pid 2136893:tid 139968756315904] Connected to backend rend01 (pub.foo.com:4503)
[Sat Aug 06 12:23:58 2022] [D] [pid 2136893:tid 139968756315904] Adding request header: Host
[Sat Aug 06 12:23:58 2022] [D] [pid 2136893:tid 139968756315904] Adding request header: User-Agent
[Sat Aug 06 12:23:58 2022] [D] [pid 2136893:tid 139968756315904] Adding request header: Accept
[Sat Aug 06 12:23:58 2022] [D] [pid 2136893:tid 139968756315904] Adding request header: Accept-Language
[Sat Aug 06 12:23:58 2022] [D] [pid 2136893:tid 139968756315904] Adding request header: Accept-Encoding
[Sat Aug 06 12:23:58 2022] [D] [pid 2136893:tid 139968756315904] Adding request header: Cookie
[Sat Aug 06 12:23:58 2022] [D] [pid 2136893:tid 139968756315904] Adding request header: Upgrade-Insecure-Requests
[Sat Aug 06 12:23:58 2022] [D] [pid 2136893:tid 139968756315904] Adding request header: Sec-Fetch-Dest
[Sat Aug 06 12:23:58 2022] [D] [pid 2136893:tid 139968756315904] Adding request header: Sec-Fetch-Mode
[Sat Aug 06 12:23:58 2022] [D] [pid 2136893:tid 139968756315904] Adding request header: Sec-Fetch-Site
[Sat Aug 06 12:23:58 2022] [D] [pid 2136893:tid 139968756315904] Adding request header: Sec-Fetch-User
[Sat Aug 06 12:23:58 2022] [D] [pid 2136893:tid 139968756315904] Adding request header: Pragma
[Sat Aug 06 12:23:58 2022] [D] [pid 2136893:tid 139968756315904] Adding request header: Cache-Control
[Sat Aug 06 12:23:58 2022] [D] [pid 2136893:tid 139968756315904] Adding request header: Via
[Sat Aug 06 12:23:58 2022] [D] [pid 2136893:tid 139968756315904] Adding request header: X-Forwarded-For
[Sat Aug 06 12:23:58 2022] [D] [pid 2136893:tid 139968756315904] Adding request header: Server-Agent
[Sat Aug 06 12:23:59 2022] [D] [pid 2136893:tid 139968756315904] Cache file successfully created: /apps/cache/content/site1/content/site1/en/test_pages/general.html
[Sat Aug 06 12:23:59 2022] [D] [pid 2136893:tid 139968756315904] response.headers[Content-Type] = "text/html;charset=utf-8"
[Sat Aug 06 12:23:59 2022] [D] [pid 2136893:tid 139968756315904] response.headers[X-Content-Type-Options] = "nosniff"
[Sat Aug 06 12:23:59 2022] [D] [pid 2136893:tid 139968756315904] Storing socket for later reuse: pub.foo.com:4503
[Sat Aug 06 12:23:59 2022] [I] [pid 2136893:tid 139968756315904] "GET /content/site1/en/test_pages/general.html" - miss [dev_site1_foo_com/rend01] 396ms
[Sat Aug 06 12:23:59 2022] [D] [pid 2132227:tid 139967951009536] Found farm dev_site1_foo_com for dev.site1.foo.com
[Sat Aug 06 12:23:59 2022] [D] [pid 2132227:tid 139967951009536] checking [/etc/designs/site1/clientlibs/css.css]
[Sat Aug 06 12:23:59 2022] [D] [pid 2132227:tid 139967951009536] cache-action for [/etc/designs/site1/clientlibs/css.css]: DELIVER
[Sat Aug 06 12:23:59 2022] [D] [pid 2132227:tid 139967951009536] request declined
[Sat Aug 06 12:23:59 2022] [D] [pid 2132227:tid 139967951009536] response.headers[Content-Type] = "text/css;charset=utf-8"
[Sat Aug 06 12:23:59 2022] [D] [pid 2132227:tid 139967951009536] response.headers[Last-Modified] = "Sat, 30 Jul 2022 20:23:15 GMT"
[Sat Aug 06 12:23:59 2022] [D] [pid 2132227:tid 139967951009536] response.headers[X-Content-Type-Options] = "nosniff"
[Sat Aug 06 12:23:59 2022] [I] [pid 2132227:tid 139967951009536] "GET /etc/designs/site1/clientlibs/css.css" - hit [dev_site1_foo_com/-] 1ms
我想我明白了,這與相應的 invalidation_only VirtualHost 配置有關。 我需要為每個引用/dam/
文件夾的站點添加一個附加行,無論出於何種原因,這不是預期的:
<LocationMatch "^/dispatcher/invalidate.cache$">
# domain A
SetEnvIf CQ-Path ".*/content/site1/.*" FLUSH_HOST=prod.site1.foo.com
*** SetEnvIf CQ-Path ".*/content/dam/site1/.*" FLUSH_HOST=prod.site1.foo.com
RequestHeader set Host %{FLUSH_HOST}e env=FLUSH_HOST
# domain B
SetEnvIf CQ-Path ".*/content/site2/.*" FLUSH_HOST=prod.site2.foo.com
*** SetEnvIf CQ-Path ".*/content/dam/site2/.*" FLUSH_HOST=prod.site2.foo.com
RequestHeader set Host %{FLUSH_HOST}e env=FLUSH_HOST
# domain C
SetEnvIf CQ-Path ".*/content/site3/.*" FLUSH_HOST=prod.site3.foo.com
*** SetEnvIf CQ-Path ".*/content/dam/site3/.*" FLUSH_HOST=prod.site3.foo.com
RequestHeader set Host %{FLUSH_HOST}e env=FLUSH_HOST
# domain D
SetEnvIf CQ-Path ".*/content/site4/.*" FLUSH_HOST=prod.site4.foo.com
*** SetEnvIf CQ-Path ".*/content/dam/site4/.*" FLUSH_HOST=prod.site4.foo.com
RequestHeader set Host %{FLUSH_HOST}e env=FLUSH_HOST
</LocationMatch>
<LocationMatch "^/invalidation_only/dispatcher/invalidate.cache$">
# domain A
SetEnvIf CQ-Path ".*/content/site1/.*" FLUSH_HOST=prod.site1.foo.com
*** SetEnvIf CQ-Path ".*/content/dam/site1/.*" FLUSH_HOST=prod.site1.foo.com
RequestHeader set Host %{FLUSH_HOST}e env=FLUSH_HOST
# domain B
SetEnvIf CQ-Path ".*/content/site2/.*" FLUSH_HOST=prod.site2.foo.com
*** SetEnvIf CQ-Path ".*/content/dam/site2/.*" FLUSH_HOST=prod.site2.foo.com
RequestHeader set Host %{FLUSH_HOST}e env=FLUSH_HOST
# domain C
SetEnvIf CQ-Path ".*/content/site3/.*" FLUSH_HOST=prod.site3.foo.com
*** SetEnvIf CQ-Path ".*/content/dam/site3/.*" FLUSH_HOST=prod.site3.foo.com
RequestHeader set Host %{FLUSH_HOST}e env=FLUSH_HOST
# domain D
SetEnvIf CQ-Path ".*/content/site4/.*" FLUSH_HOST=prod.site4.foo.com
*** SetEnvIf CQ-Path ".*/content/dam/site4/.*" FLUSH_HOST=prod.site4.foo.com
RequestHeader set Host %{FLUSH_HOST}e env=FLUSH_HOST
</LocationMatch>
把它全部放在問題中幫助我看到了問題。 我希望它對其他人有所幫助-即使這在某種程度上是一種邊緣情況(我認為通常會找到 DAM)。
來自上述博客的說明(我認為最初存在於其他地方)非常有幫助。
不幸的是,我認為 Adobe 官方文檔中的任何地方都沒有提到這個概念,而且在其他地方也不容易找到。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.