我在调度程序中有以下配置文件用于缓存。我可以缓存js,css但不能缓存JPEG / PNG。如果我在某个地方出错,请建议我?我还需要缓存图像
ExpiresActive On
ExpiresByType text/css "access plus 1 month"
ExpiresByType text/x-javascript "access plus 1 month"
ExpiresByType image/jpg "access plus 1 month"
ExpiresByType image/png "access plus 1 month"
ExpiresByType image/jpeg "access plus 1 month"
ExpiresByType image/gif "access plus 1 month"
ExpiresByType image/x-icon "access plus 1 month"
ExpiresDefault "access plus 2 days"
这是dispatcher.any文件配置
# Hello Publish Farm
/publishfarm_hello
{
# client headers which should be passed through to the render instances
# (feature supported since dispatcher build 2.6.3.5222)
/clientheaders
{
"referer"
"user-agent"
"authorization"
"from"
"content-type"
"content-length"
"accept-charset"
"accept-encoding"
"accept-language"
"accept"
"host"
"if-match"
"if-none-match"
"if-range"
"if-unmodified-since"
"max-forwards"
"proxy-authorization"
"proxy-connection"
"range"
"cookie"
"cq-action"
"cq-handle"
"handle"
"action"
"cqstats"
"depth"
"translate"
"expires"
"date"
"dav"
"ms-author-via"
"if"
"lock-token"
"x-expected-entity-length"
"destination"
}
# hostname globbing for farm selection (virtual domain addressing)
/virtualhosts
{
$include "publish-vhosts-hello.any"
}
# the load will be balanced among these render instances
/renders
{
$include "publish-renders-hello.any"
}
# only handle the requests in the following acl. default is 'none'
# the glob pattern is matched against the first request line
/filter
{
$include "publish-filter-hello.any"
}
# allow propagation of replication posts (should seldomly be used)
/propagateSyndPost "0"
# the cache is used to store requests from the renders for faster delivery
# for a second time.
/cache
{
# the cacheroot must be equal to the document root of the webserver
/docroot "/mnt/var/www/html/content/hello"
# sets the level upto which files named ".stat" will be created in the
# document root of the webserver. when an activation request for some
# handle is received, only files within the same subtree are affected
# by the invalidation.
/statfileslevel "0"
# caches also authorized data
/allowAuthorized "0"
# the rules define, which pages should be cached. please note that
# - only GET requests are cached
# - only requests with an extension are cached
# - only requests without query parameters ( ? ) are cached
# - only unauthorized pages are cached unless allowUnauthorized is set to 1
/rules
{
/0000
{
# the globbing pattern to be compared against the url
# example: * -> everything
# : /foo/bar.* -> only the /foo/bar documents
# : /foo/bar/* -> all pages below /foo/bar
# : /foo/bar[./]* -> all pages below and /foo/bar itself
# : *.html -> all .html files
/glob "*"
/type "allow"
}
/0003
{
#added for Hello Online Forms
/glob "/content/hello-online-forms[./]*" /type "deny"
}
}
# the invalidate section defines those pages which are 'invalidated' after
# any activation. please note that, the activated page itself and all
# related documents are flushed on an modification. for example: if the
# page /foo/bar is activated, all /foo/bar.* files are removed from the
# cache.
/invalidate
{
/0000
{
/glob "*"
/type "deny"
}
/0001
{
/glob "*.html"
/type "allow"
}
/0002
{
/glob "*.css"
/type "allow"
}
}
/allowedClients
{
/0000
{
/glob "*.*.*.*"
/type "deny"
}
$include "publish-invalidate-allowed.any"
}
}
# the statistics define, how the load should be balanced among the renders
# according to the media-type.
/statistics
{
/categories
{
/html
{
/glob "*.html"
}
/others
{
/glob "*"
}
}
}
答案 0 :(得分:2)
根据AEM documentation,您可以使用" / rules"来控制基于适当文档路径缓存的文档。属性。 请检查/ rules属性
下是否有类似于以下的配置/rules
{
# initial blanket deny
/0000
{
/glob "*"
/type "deny"
}
# low-change static assets
/0001
{
/glob "*.png"
/type "allow"
}
/0002
{
/glob "*.gif"
/type "allow"
}
/0003
{
/glob "*.jpg"
/type "allow"
}
/0004
{
/glob "*.jpeg"
/type "allow"
}
如果根据adobe link,那么在某些情况下调度员永远不会缓存文档。请查看您的案例是否与这些情况相符
答案 1 :(得分:0)
您是否在调度程序缓存中看到图像?基本上,您共享的配置是针对mod_expire的,与调度程序无关。据我所知,mod_expire不会应用标头,除非资源是从apache提供的(不是从AEM蒸来的)。