개요
컬렉션을 사용해 정리하기
내 환경설정을 기준으로 콘텐츠를 저장하고 분류하세요.
Google AMP Cache는 웹에 게시된 유효한 AMP 콘텐츠의
캐시된 사본을 제공합니다.
Google AMP Cache에서 직접 콘텐츠를 제공하여 빠른 사용자 환경을 제공합니다.
Google AMP Cache를 활용하려면 AMP 캐시 URL 형식을 사용하여 캐시에서 직접 AMP URL에 액세스해야 합니다.
사용자가 캐시에서 AMP 콘텐츠에 액세스할 때마다 콘텐츠가 자동으로 업데이트되고, 콘텐츠가 캐시된 후 업데이트된 버전이 다음 사용자에게 제공됩니다.
AMP Cache URL 형식은 다음과 같은 구성요소로 구성됩니다.
구성요소 |
설명 |
하위 도메인 이름 |
Google AMP Cache에서 생성된 하위 도메인은 글자 수 제한 및 기술 사양에서 허용하는 경우 사람이 읽을 수 있으며 게시자의 자체 도메인과 매우 유사합니다. 가능한 경우 Google AMP Cache는 다음 방법으로 각 하위 도메인을 만듭니다.
- AMP 문서 도메인을 IDN (Punycode)에서 UTF-8로 변환
- 모든 ','(대시)를 \'(—
- 모든 점(점)을 쉼표(대시)로 대체합니다.
- IDN (Punycode)으로 다시 변환합니다.
예를 들어 pub.com 는 pub-com.cdn.ampproject.org 에 매핑됩니다.
기술적 한계로 인해 사람이 읽을 수 있는 하위 도메인이 차단되는 경우에는 단방향 해시가 대신 사용됩니다. |
콘텐츠 유형 |
콘텐츠 유형은 AMP HTML 문서의 경우, 글꼴의 경우 &;,
Google AMP Cache는 이러한 콘텐츠 유형과 일치하지 않는 리소스에 대해 404 오류를 반환합니다(핵심 오류 참고). |
선택사항입니다. |
해당되는 경우 Google이 TLS (보안 HTTPS)를 사용하여 출처에서 콘텐츠를 가져와야 합니다. 존재하지 않는 경우 일반 HTTP를 사용하여 출처에서 콘텐츠를 가져옵니다. |
URI |
가져올 콘텐츠의 URI입니다. URI는 스키마를 포함할 수 없습니다. 즉, 'http://' 또는 'https://'는 포함할 수 없습니다. |
하위 도메인 이름 찾기
일반적으로 Google AMP Cache URL의 하위 도메인 이름은 위에 설명된 단계를 사용하여 사람이 읽을 수 있는 원본 URL 변환이 됩니다. 그러나 실제로는 그렇지 않은 상황이 있을 수 있으므로 프로덕션에 즉시 사용 가능한 애플리케이션을 위해 Google AMP Cache URL을 검색하는 가장 좋은 방법은 Google AMP Cache URL API를 사용하는 것입니다.
비프로덕션 상황의 경우 Google AMP Cache에서 생성되는 하위 도메인 이름을 확인하려면 amp.dev에서 Google AMP Cache 사용 대화형 도구를 사용해 보세요.
TLS를 사용한 문서 요청 예
https://example.com/amp_document.html
에서 가져온 AMP HTML 문서 (/c
접두사로 지정)에 대한 요청입니다.
https://example-com.cdn.ampproject.org/c/s/example.com/amp_document.html
/s
는 /c
프리픽스를 따르므로 TLS를 사용하여 example.com에서 문서를 가져옵니다.
일반 HTTP를 사용한 이미지 요청 예
http://example.com/logo.png
에서 가져온 이미지 (/i
프리픽스로 지정)에 대한 요청입니다.
https://example-com.cdn.ampproject.org/i/example.com/logo.png
/i
접두사 다음에 /s
가 없기 때문에 Google은 TLS를 통한 HTTP가 아닌 일반 HTTP를 사용하여 example.com에서 이미지를 가져옵니다.
쿼리 매개변수 예
쿼리 캐시의 매개변수도 AMP Cache URL 형식에 포함될 수 있습니다.
다음은 매개변수가 있는 HTTPS 예입니다.
https://example-com.cdn.ampproject.org/c/s/example.com/g?value=Hello%20World
Google AMP Cache 업데이트
사용자가 Google AMP Cache에서 AMP 문서를 요청하면 콘텐츠가 캐시된 후 다음 사용자에게 새로운 콘텐츠를 제공하기 위해 캐시가 자동으로 업데이트를 요청합니다.
이 모델을 사용하면 AMP 문서 업데이트가 자동으로 신속하게 전파되므로 업데이트 후 업데이트되지 않는 버전이 표시되는 사용자는 거의 없습니다.
캐시는 "stale-between-revalidate" 모델을 따릅니다.
Max-Age
와 같은 출처의 캐싱 헤더를 사용하여 특정 문서나 리소스가 오래되었는지 여부를 판단합니다.
사용자가 오래된 항목을 요청하면 이 요청으로 인해 새 사본이 가져오므로 다음 사용자는 새 콘텐츠를 가져올 수 있습니다.
게시자 사이트에서 생성되는 로드 양을 제한하기 위해 Google AMP Cache는 모든 문서를 15초 이상 새로고침하고 모든 리소스는 1분 이상 새로고침한다고 간주합니다.
게시자 사이트에서의 새로고침 및 로드 간의 최적의 균형을 위해 캐시를 조정하므로 이 수치는 향후 변경될 수 있습니다.
캐시 최적화 및 수정
Google AMP Cache는 최적화 및 수정을 다음과 같이 수행합니다.
- 콘텐츠가 AMP 형식이며 모든 AMP 성능 목표를 충족하는지 확인합니다.
- AMP 문서 외에도 이미지와 글꼴을 캐시합니다.
- 브라우저 메모리 문제 및 낮은 응답성을 방지하기 위해 최대 이미지 크기를 제한합니다.
amp-img
태그를 통해 이미지의 전송 효율성을 개선하는 다음과 같은 다양한 변환이 있습니다.
- 특정 메타데이터와 같이 보이지 않거나 알아보기 어려운 데이터 삭제
- WebP를 지원하는 브라우저에서 GIF, PNG, JPEG 형식 이미지를 WebP로 변환하는 등 이미지를 더 모바일 친화적이고 작은 이미지 형식으로 변환합니다.
- 요청에 Save-Data 헤더가 포함된 경우 이미지를 더 낮은 화질로 변환합니다.
- 대체 크기 버전을 생성하고
srcset
속성을 추가하여 반응형 크기의 이미지 제공을 지원합니다.
- 보안 채널 (HTTPS)을 통해 제공되며 최신 웹 프로토콜 (SPDY, HTTP/2)을 사용합니다.
- AMP 문서를 정리하여 HTML 태그, 댓글 등을 잘못 기준으로 XSS 공격을 방지합니다.
위의 변환 시 Google AMP Cache는 'Cache-Control: no-transform' 헤더를 무시합니다.
HTML 정리
Google AMP Cache는 모든 문서를 다시 작성하여 파싱을 정규화합니다.
예를 들면 다음과 같습니다.
- 모든 HTML 주석은 제거됩니다.
- 태그 및 속성 이름은 소문자로 표시됩니다.
- 속성 값은 일관되게 따옴표로 묶고 이스케이프 처리됩니다.
- HTML5 void 요소를 제외한 모든 태그가 닫힙니다.
- 태그 안의 공백은 삭제됩니다.
- 텍스트가 이스케이프 처리됩니다.
- 인코딩된 텍스트 문자는 UTF-8 등가 문자를 사용하여 간소화됩니다.
body
에만 포함될 수 있는 요소가 body
로 이동됩니다.
- 아웃바운드 링크는 게시자 출처 대신 Google AMP Cache 출처에서 제공될 때 계속 작동하도록 절대적으로 구성됩니다.
Google AMP Cache는 이전에 리소스를 로드하는 데 도움이 되도록 브라우저에 다양한 미리 가져오기 힌트 태그를 추가합니다.
예를 들어 <link href='https://fonts.googleapis.com/css?family=Lato' rel='stylesheet’>
는 다음과 같이 변경됩니다.
<link href="https://fonts.googleapis.com/css?family=Lato" rel="stylesheet">
<link href="https://fonts.gstatic.com" rel="dns-prefetch preconnect">
달리 명시되지 않는 한 이 페이지의 콘텐츠에는 Creative Commons Attribution 4.0 라이선스에 따라 라이선스가 부여되며, 코드 샘플에는 Apache 2.0 라이선스에 따라 라이선스가 부여됩니다. 자세한 내용은 Google Developers 사이트 정책을 참조하세요. 자바는 Oracle 및/또는 Oracle 계열사의 등록 상표입니다.
최종 업데이트: 2023-08-30(UTC)
[[["이해하기 쉬움","easyToUnderstand","thumb-up"],["문제가 해결됨","solvedMyProblem","thumb-up"],["기타","otherUp","thumb-up"]],[["필요한 정보가 없음","missingTheInformationINeed","thumb-down"],["너무 복잡함/단계 수가 너무 많음","tooComplicatedTooManySteps","thumb-down"],["오래됨","outOfDate","thumb-down"],["번역 문제","translationIssue","thumb-down"],["샘플/코드 문제","samplesCodeIssue","thumb-down"],["기타","otherDown","thumb-down"]],["최종 업데이트: 2023-08-30(UTC)"],[[["\u003cp\u003eGoogle AMP Cache delivers cached copies of valid AMP content for a faster user experience.\u003c/p\u003e\n"],["\u003cp\u003eUtilize the AMP Cache URL format to access content directly from the cache, ensuring automatic updates with each user access.\u003c/p\u003e\n"],["\u003cp\u003eThe Google AMP Cache optimizes and modifies content, including image transformations, security enhancements, and HTML sanitization, to improve delivery and performance.\u003c/p\u003e\n"],["\u003cp\u003eThe cache employs a "stale-while-revalidate" model, using origin caching headers and automatic updates to balance content freshness with publisher site load.\u003c/p\u003e\n"]]],["The Google AMP Cache stores and serves cached AMP content for fast user experiences. Accessing content via the AMP Cache URL format triggers automatic updates. The format includes a subdomain, content type (`c`, `i`, or `r`), optional `s` for TLS, and the content's URI. Content is considered fresh for at least 15 seconds (documents) or 1 minute (resources) before being revalidated. The cache optimizes content, such as images and documents, by validating AMP format, applying various transformations, and sanitizing HTML, for efficient and secure delivery.\n"],null,["# Overview\n\nThe Google AMP Cache serves cached copies\nof valid AMP content published to the web.\nServe content directly from the Google AMP Cache\nto provide a fast user experience.\n\n\nTo take advantage of the Google AMP Cache,\nan AMP URL must be accessed directly from the cache\nusing the AMP Cache URL format.\nEach time a user accesses AMP content from the cache,\nthe content is automatically updated,\nand the updated version is served to the next user once the content has been cached.\n\nAMP Cache URL format\n--------------------\n\n\nThe AMP Cache URL format consists of the following components:\n\n| Component | Description |\n|----------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| Subdomain name | Subdomains created by the Google AMP Cache will be human-readable when character limits and technical specs allow, and will closely resemble the publisher's own domain. When possible, the Google AMP Cache will create each subdomain by: 1. Converting the AMP document domain from IDN (Punycode) to UTF-8. 2. Replacing every \"-\" (dash) with \"--\"(2 dashes). 3. Replacing every \".\" (dot) with a \"-\" (dash). 4. Converting back to IDN (Punycode). For example, `pub.com` will map to `pub-com.cdn.ampproject.org`. Where technical limitations prevent a human readable subdomain, a one-way hash will be used instead. |\n| Content type | The content type is one of the following: 'c' for an AMP HTML document, 'i' for an image, or 'r' for a resource such as a font. The Google AMP Cache returns a 404 error for resources that do not match these content types (see the [core error](/amp/cache/reference/errors/core_errors#NOT_FOUND)). |\n| Optional 's' | If present, requires that Google fetch the content from the origin using TLS (secure HTTPS). If the 's' is not present, then content gets fetched from the origin using plain HTTP. |\n| URI | URI of the content to be fetched. The URI cannot contain a scheme; that is, no \\`http://\\` or \\`https://\\`. |\n\n| **Note:** Use the [AMP URL API](/amp/cache/reference/acceleratedmobilepageurl/rest/v1/ampUrls/batchGet), to match URLs to corresponding AMP URLs and serve the AMP versions instead (see [Link to AMP Content](/amp/cache/use-amp-url)).\n\n### Finding the subdomain name\n\nTypically, the subdomain name for a Google AMP Cache URL will be a human-readable conversion of\nthe original URL using the steps outlined above. However, because there are circumstances where\nthis may not be true, the best way to retrieve Google AMP Cache URLs for production-ready\napplications is to use the [Google AMP Cache URL API](/amp/cache/use-amp-url).\n\nFor non-production situations, to determine what subdomain name the Google AMP Cache generates,\ntry out the [Using the Google AMP Cache](https://amp.dev/documentation/examples/guides/using_the_google_amp_cache/)\ninteractive tool on [amp.dev](https://amp.dev/documentation/examples/guides/using_the_google_amp_cache/).\n\n### Example requesting document using TLS\n\nRequest for an AMP HTML document (specified with the `/c` prefix)\nfetched from `https://example.com/amp_document.html`: \n\n```\nhttps://example-com.cdn.ampproject.org/c/s/example.com/amp_document.html\n```\n\nBecause `/s` follows the `/c` prefix,\nthe document will be fetched from example.com using TLS.\n\n### Example requesting image using plain HTTP\n\nRequest for an image (specified with the `/i` prefix)\nfetched from `http://example.com/logo.png`: \n\n```\nhttps://example-com.cdn.ampproject.org/i/example.com/logo.png\n```\n\nBecause there's no `/s` following the `/i` prefix,\nGoogle fetches the image from example.com using plain HTTP,\nnot HTTP over TLS.\n\n### Query parameter example\n\nThe AMP Cache URL format can also include parameters in the query string.\nThe following is an HTTPS example with parameters:\n`https://example-com.cdn.ampproject.org/c/s/example.com/g?value=Hello%20World`\n\nGoogle AMP Cache updates\n------------------------\n\nWhen a user requests an AMP document from the Google AMP Cache,\nthe cache automatically requests updates in order to be able\nto serve fresh content for the next user once the content has been cached.\nWith this model, updates to AMP documents propagate automatically and quickly;\nfew users will see the non-updated version after your update.\n\n\nThe cache follows a \"stale-while-revalidate\" model.\nIt uses the origin's caching headers, such as `Max-Age`,\nas hints in deciding whether a particular document or resource is stale.\nWhen a user makes a request for something that is stale,\nthat request causes a new copy to be fetched, so that the next user gets fresh content.\n\n\nTo limit the amount of load it generates for publisher sites,\nthe Google AMP Cache considers any document fresh for at least 15 seconds,\nand any resource fresh for at least 1 minute.\nNote that those numbers may change in the future,\nas we tune the cache for optimum balance between freshness and load on publisher sites.\n\nCache optimizations and modifications\n-------------------------------------\n\nThe Google AMP Cache performs optimizations and modifications,\nsuch as the following:\n\n- Validates content is truly in AMP format, meeting all AMP performance goals.\n- Caches images and fonts in addition to AMP documents.\n- Limits maximum image dimensions to prevent browser memory issues and poor responsiveness.\n- Various transformations to improve the delivery efficiency of images via the `amp-img` tag, such as:\n - Removal of data that is invisible or difficult to see, such as certain metadata.\n - Conversion of images to smaller and mobile-friendlier image formats, such as converting GIF, PNG, and JPEG format images to WebP in browsers that support WebP.\n - Transformation of the image to a lower quality if the request includes the Save-Data header.\n - Generation of alternatively sized versions and adding `srcset` attributes to support delivery of responsively sized images.\n- Serves over a secure channel (HTTPS) and uses the latest web protocols (SPDY, HTTP/2).\n- Sanitizes AMP documents to prevent XSS attacks based on incorrectly closed HTML tags, comments, and more.\n\n\nIn making the above transformations,\nthe Google AMP Cache disregards the \"Cache-Control: no-transform\" header.\n\nHTML sanitization\n-----------------\n\n\nThe Google AMP Cache rewrites all documents to normalize parsing.\nExamples include:\n\n- All HTML comments are stripped.\n- Tag and attribute names are lowercased.\n- Attribute values are consistently quoted and escaped.\n- All tags are closed, except for HTML5 void elements.\n- Whitespace inside tags is stripped.\n- Text is escaped.\n- Encoded text characters are simplified, using UTF-8 equivalent characters.\n- Elements that can only be in the `body` get moved into the `body`.\n- Outbound links are made absolute so that they continue to work when the document is served from the Google AMP Cache origin instead of the publisher origin.\n\nInsert prefetch tags\n--------------------\n\nThe Google AMP Cache adds various prefetch hint tags for browsers\nto assist in loading resources earlier.\nFor example,\n`\u003clink href='https://fonts.googleapis.com/css?family=Lato' rel='stylesheet'\u003e`\nchanges to: \n\n```text\n\u003clink href=\"https://fonts.googleapis.com/css?family=Lato\" rel=\"stylesheet\"\u003e\n\u003clink href=\"https://fonts.gstatic.com\" rel=\"dns-prefetch preconnect\"\u003e\n```"]]