부실 상태 처리 없이 HTML 콘텐츠 형식 ​의 웹 브라우저 및 CDN 캐시 수명을 10분(으)로 늘리려면 다음 단계를 수행합니다.

  1. AEM 프로젝트에서 dispatcher/src/conf.d/available_vhosts 디렉터리에서 원하는 가상 파일을 찾습니다.

  2. vhost(예: wknd.vhost) 파일을 다음과 같이 업데이트합니다.

    <LocationMatch "^/content/.*\.(html)$">
        # Removes the response header if present
        Header unset Cache-Control
    
        # Instructs the web browser and CDN to cache the response for max-age value (600) seconds.
        Header set Cache-Control "max-age=600"
    </LocationMatch>
    

    dispatcher/src/conf.d/enabled_vhosts 디렉터리의 vhost 파일이 dispatcher/src/conf.d/available_vhosts 디렉터리의 파일에 대해 symlinks ​이므로 없는 경우 symlink를 만드십시오.

  3. Cloud Manager - 웹 계층 구성 파이프라인 또는 RDE 명령을 사용하여 원하는 AEM as a Cloud Service 환경에 vhost 변경 사항을 배포합니다.

그러나 웹 브라우저 및 CDN 캐시 수명에 대해 다른 값을 갖기 위해 위의 예에서 Surrogate-Control 헤더를 사용할 수 있습니다. 마찬가지로 특정 날짜 및 시간에 캐시를 만료하려면 Expires 헤더를 사용할 수 있습니다. 또한 stale-while-revalidatestale-if-error 특성을 사용하여 응답 콘텐츠의 부실 상태 처리를 제어할 수 있습니다. AEM WKND 프로젝트에 참조 부실 상태 처리 CDN 캐시 구성이 있습니다.

마찬가지로 다른 콘텐츠 유형(JSON, JS, CSS 및 Assets)의 캐시 헤더도 업데이트할 수 있습니다.

사용자 지정 Java™ 코드

이 옵션은 AEM 게시와 작성자 모두에서 사용할 수 있습니다. 그러나 AEM Author에서 캐싱을 활성화하고 기본 캐싱 동작을 유지하는 것은 권장되지 않습니다.

캐시 헤더를 업데이트하려면 사용자 지정 Java™ 코드의 HttpServletResponse 개체(Sling 서블릿, Sling 서블릿 필터)를 사용합니다. 일반 구문은 다음과 같습니다.

// Instructs the web browser and CDN to cache the response for 'max-age' value (XXX) seconds. The 'stale-while-revalidate' and 'stale-if-error' attributes controls the stale state treatment at CDN layer.
response.setHeader("Cache-Control", "max-age=XXX,stale-while-revalidate=XXX,stale-if-error=XXX");

// Instructs the CDN to cache the response for 'max-age' value (XXX) seconds. The 'stale-while-revalidate' and 'stale-if-error' attributes controls the stale state treatment at CDN layer.
response.setHeader("Surrogate-Control", "max-age=XXX,stale-while-revalidate=XXX,stale-if-error=XXX");

// Instructs the web browser and CDN to cache the response until the specified date and time.
response.setHeader("Expires", "Sun, 31 Dec 2023 23:59:59 GMT");
이전 페이지CDN 캐시 적중률 분석
다음 페이지캐싱 비활성화

Experience Manager