{"id":22817,"date":"2023-09-16T21:59:28","date_gmt":"2023-09-16T12:59:28","guid":{"rendered":"http:\/\/www.code-magagine.com\/?p=22817"},"modified":"2023-09-23T12:20:56","modified_gmt":"2023-09-23T03:20:56","slug":"%e3%80%90web%e6%8a%80%e8%a1%93%e3%80%91","status":"publish","type":"post","link":"http:\/\/www.code-magagine.com\/?p=22817","title":{"rendered":"\u3010Web\u6280\u8853\u3011Cache-Control\u8abf\u67fb"},"content":{"rendered":"\n<h2 class=\"wp-block-heading\">\u9759\u7684\u30b3\u30f3\u30c6\u30f3\u30c4\u3078\u306e\u6307\u5b9a\u4f8b<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\">\u30b5\u30a4\u30c8A<\/h3>\n\n\n\n<p>36\u65e5\u534a\u306e\u6307\u5b9a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>public,max-age=31536000,must-revalidate<\/code><\/pre>\n\n\n\n<h4 class=\"wp-block-heading\">must-revalidate<\/h4>\n\n\n\n<p>\u30ad\u30e3\u30c3\u30b7\u30e5\u306f\u671f\u9650\u304c\u5207\u308c\u305f\u304b\u3089\u3068\u3044\u3063\u3066\u5fc5\u305a\u518d\u53d6\u5f97\u304c\u884c\u308f\u308c\u308b\u308f\u3051\u3067\u306f\u306a\u3044\u3067\u3059\u3002\u305f\u3060\u3001\u3053\u306e\u30aa\u30d7\u30b7\u30e7\u30f3\u3092\u4f7f\u3048\u3070\u5f37\u5236\u7684\u306b\u30ad\u30e3\u30c3\u30b7\u30e5\u306e\u518d\u53d6\u5f97\u3092\u884c\u308f\u305b\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002\u300c\u30ad\u30e3\u30c3\u30b7\u30e5\u306e\u671f\u9650\u304c\u5207\u308c\u305f\u3089\u518d\u691c\u8a3c\u3092\u884c\u3046\u300d\u3068\u3044\u3046\u610f\u5473\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">next.js\u306e\u9759\u7684\u30b3\u30f3\u30c6\u30f3\u30c4<\/h3>\n\n\n\n<p>next\/image\u306e\u753b\u50cf\u4ee5\u5916\u306e\u9759\u7684\u30b3\u30f3\u30c6\u30f3\u30c4\u306f\u4ee5\u4e0b\u306e\u8a2d\u5b9a\u306b\u306a\u308b\u3002\uff08js\u3084css\u306a\u3069\uff09<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>public, max-age=315360000, immutable<\/code><\/pre>\n\n\n\n<h4 class=\"wp-block-heading\">immutable<\/h4>\n\n\n\n<p>\u30ad\u30e3\u30c3\u30b7\u30e5\u3057\u305f\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u304c\u5909\u66f4\u3055\u308c\u306a\u3044\u3068\u3044\u3046\u610f\u5473\u306b\u306a\u308a\u307e\u3059\u3002\u306a\u306e\u3067\u3001\u5f8c\u304b\u3089\u30ad\u30e3\u30c3\u30b7\u30e5\u306e\u671f\u9650\u3092\u77ed\u3081\u306b\u5909\u66f4\u3059\u308b\u306a\u3069\u3057\u3066\u30ad\u30e3\u30c3\u30b7\u30e5\u3092\u5909\u66f4\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u306a\u304f\u306a\u308a\u307e\u3059\u3002\uff08\u518d\u5ea6\u65b0\u3057\u3044\u30c7\u30fc\u30bf\u3092\u53d6\u5f97\u3057\u305f\u3051\u308c\u3070\u65b0\u3057\u3044URL\u3092\u53d6\u5f97\u3057\u3066\u304f\u3060\u3055\u3044\u306d\u3068\u3044\u3046\u3068\u3044\u3046\u610f\u5473\u306b\u306a\u308b\u3002\uff09<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">next\/Image<\/h3>\n\n\n\n<p>\u30ad\u30e3\u30c3\u30b7\u30e5\u3055\u308c\u306a\u3044\u3088\u3046\u306b\u3057\u3066\u3044\u308b\u3002\u305f\u3060\u3001ETag\u3067\u5f31\u3044\u30ad\u30e3\u30c3\u30b7\u30e5\u304c\u4f7f\u308f\u308c\u3066\u3044\u3066\u753b\u50cf\u306e\u5dee\u3057\u66ff\u3048\u304c\u306a\u3044\u9650\u308a\u306f304\u304c\u8fd4\u308b\u306e\u3067\u901a\u4fe1\u91cf\u304c\u6e1b\u308b\u3068\u3044\u3046\u3088\u3046\u306a\u8a2d\u5b9a\u306b\u306a\u3063\u3066\u3044\u308b\u3002<\/p>\n\n\n\n<p>public, max-age=0, must-revalidate<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">\u500b\u4eba\u60c5\u5831\u3092\u542b\u3080API\u306a\u3069\u3067\u30ad\u30e3\u30c3\u30b7\u30e5\u3055\u305b\u306a\u3044\u5834\u5408\uff08\u30ed\u30b0\u30a4\u30f3\u5f8c\u306e\u30de\u30a4\u30da\u30fc\u30b8\u306e\u30d5\u30a7\u30c3\u30c1\u30f3\u30b0\u306a\u3069\uff09<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\">\u30b5\u30a4\u30c8A<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>no-cache\u3001no-store\u3001max-age=0<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">next\/Image<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>public, max-age=0, must-revalidate<\/code><\/pre>\n\n\n\n<p>\u500b\u4eba\u60c5\u5831\u3092\u542b\u3080\u5834\u5408\u306f\u4ed6\u4eba\u306b\u30c7\u30fc\u30bf\u304c\u6f0f\u6d29\u3059\u308b\u3068\u307e\u305a\u3044\u306e\u3067Web\u30b5\u30fc\u30d0\u30fc\u3084CDN\u306eCache-Contorl\u3067\u30ad\u30e3\u30c3\u30b7\u30e5\u3057\u306a\u3044\u3088\u3046\u306b\u3057\u307e\u3059\u304c\u3001React-Query\u306a\u3069\u306e\u30af\u30e9\u30a4\u30a2\u30f3\u30c8\u30b5\u30a4\u30c9\u306e\u30ad\u30e3\u30c3\u30b7\u30e5\u6a5f\u69cb\u3092\u4f7f\u3048\u3070\u540c\u3058\u3088\u3046\u306b\u30ad\u30e3\u30c3\u30b7\u30e5\u304c\u3067\u304d\u308b\u306e\u3067\u5f37\u3044\u6574\u5408\u6027\u304c\u5fc5\u8981\u306e\u306a\u3044\u30da\u30fc\u30b8\u3067\u3042\u308c\u3070\u6d3b\u7528\u3057\u3066\u307f\u3066\u3082\u826f\u3044\u3067\u3059\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">\u4e3b\u306b\u500b\u4eba\u60c5\u5831\u3092\u542b\u307e\u306a\u3044\u304c\u3001\u6574\u5408\u6027\u304c\u305d\u3053\u307e\u3067\u5f37\u304f\u306a\u304f\u3066\u3082\u3088\u3044\u30da\u30fc\u30b8\u306e\u5834\u5408(\u4f8b\uff1a\u30d6\u30ed\u30b0\u5185\u5bb9\u3001\u5546\u54c1\u4e00\u89a7\u306a\u3069\u8ab0\u304c\u898b\u3066\u3082\u691c\u7d22\u7d50\u679c\u304c\u540c\u3058\u3082\u306e)<\/h2>\n\n\n\n<pre class=\"wp-block-code\"><code>public,s-max=10,stale-while-revalidate=86400<\/code><\/pre>\n\n\n\n<p>\u521d\u56de\u30ea\u30af\u30a8\u30b9\u30c8\u3067\u306f\u6700\u65b0\u30c7\u30fc\u30bf\u3092\u8868\u793a\u300110\u79d2\u9593\u306f\u4f55\u5ea6\u66f4\u65b0\u3057\u3066\u3082\u53e4\u3044\u30c7\u30fc\u30bf\u306b\u306a\u308b\u300211\u79d2\u4ee5\u964d\u306b\u30a2\u30af\u30bb\u30b9\u3059\u308b\u3068\u3001\u65b0\u3057\u3044\u30ad\u30e3\u30c3\u30b7\u30e5\u304c\u4f5c\u3089\u308c\u308b\u3002\u305d\u306e\u6b21\u306e\u30a2\u30af\u30bb\u30b9\u3067\u6700\u65b0\u306b\u306a\u308b\u3002<\/p>\n\n\n\n<p>86400\u79d2\uff081\u65e5\uff09\u3067\u81ea\u52d5\u7684\u306b\u30ad\u30e3\u30c3\u30b7\u30e5\u306f\u7834\u68c4\u3055\u308c\u308b\u3002<\/p>\n\n\n\n<p>\u306a\u306e\u30671\u65e5\u306e\u9593\u306f\u6570\u6642\u9593\u3068\u304b\u30a2\u30af\u30bb\u30b9\u306e\u9593\u9694\u304c\u7a7a\u3044\u305f\u3068\u3057\u3066\u3082\u6570\u6642\u9593\u524d\u306b\u30a2\u30af\u30bb\u30b9\u3057\u305f\u30c7\u30fc\u30bf\u3067\u30da\u30fc\u30b8\u3092\u8868\u793a\u3055\u305b\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n\n\n\n<p>Next.js\u306estale-while-revalidate\u3092Rails\u3084Laravel\u306a\u3069\u4ed6\u306e\u30d5\u30ec\u30fc\u30e0\u30ef\u30fc\u30af\u3067\u3082\u5b9f\u73fe\u3067\u304d\u307e\u3059\u3002\uff08\u305f\u3060\u3001Next.js\u306eSG+ISR\u306e\u65b9\u304c\u3001SSR\u3084Rails\u3084Laravel\u306a\u3069\u306e\u6bce\u56de\u52d5\u7684\u751f\u6210\u306b\u6bd4\u3079\u305f\u3089\u63cf\u753b\u306f\u9045\u304f\u306a\u308b\u3002\uff09<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">\u500b\u4eba\u60c5\u5831\u3092\u542b\u307e\u306a\u3044API\u30d5\u30a7\u30c3\u30c1<\/h2>\n\n\n\n<p>\u305d\u306e\u969b\u3082\u30b5\u30fc\u30d0\u30fc\u5074\u3067Cache-Control\u3092\u8a2d\u5b9a\u3057\u3066\u30b3\u30f3\u30c8\u30ed\u30fc\u30eb\u306f\u53ef\u80fd\u3067\u3059\u3002\u753b\u9762\u3054\u3068\u306b\u30ad\u30e3\u30c3\u30b7\u30e5\u3092\u7d30\u304b\u304f\u30b3\u30f3\u30c8\u30ed\u30fc\u30eb\u3057\u305f\u3044\u5834\u5408\u3082\u3042\u308b\u304b\u3068\u306f\u601d\u3044\u307e\u3059\u3002<\/p>\n\n\n\n<p>\u305d\u306e\u5834\u5408\u306f\u3001React-Query\u3084SWR\u306a\u3069\u3067\u30ed\u30fc\u30ab\u30eb\u3067\u30ad\u30e3\u30c3\u30b7\u30e5\u30b3\u30f3\u30c8\u30ed\u30fc\u30eb\u304c\u3067\u304d\u308b\u30e9\u30a4\u30d6\u30e9\u30ea\u304c\u6700\u8fd1\u306f\u3042\u308b\u306e\u3067\u691c\u8a0e\u3059\u308b\u3053\u3068\u306b\u306a\u308a\u307e\u3059\u3002\uff08\u305f\u3060\u3001\u305d\u306e\u5834\u5408\u30b5\u30fc\u30d0\u30fc\u3067\u8a2d\u5b9a\u3055\u308c\u3066\u3044\u308bCache-Control\u306e\u30ad\u30e3\u30c3\u30b7\u30e5\u3068\u7af6\u5408\u3057\u306a\u3044\u3088\u3046\u306b\u3059\u308b\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059\u3002\u57fa\u672c\u7684\u306bAPI\u4f5c\u308b\u969b\u306f\u500b\u4eba\u60c5\u5831\u306e\u3042\u308b\u306a\u3057\u306b\u9650\u3089\u305a\u30ad\u30e3\u30c3\u30b7\u30e5\u3057\u306a\u3044\u3053\u3068\u306b\u3057\u3066\u3044\u308b\u73fe\u5834\u304c\u591a\u3044\u3068\u601d\u3046\u306e\u3067\u305d\u3053\u307e\u3067\u5fc3\u914d\u306f\u306a\u3044\u304b\u3082\u3057\u308c\u307e\u305b\u3093\u304c\u3002\uff09<\/p>\n","protected":false},"excerpt":{"rendered":"\u9759\u7684\u30b3\u30f3\u30c6\u30f3\u30c4\u3078\u306e\u6307\u5b9a\u4f8b \u30b5\u30a4\u30c8A 36\u65e5\u534a\u306e\u6307\u5b9a must-revalidate \u30ad\u30e3\u30c3\u30b7\u30e5\u306f\u671f\u9650\u304c\u5207\u308c\u305f\u304b\u3089\u3068\u3044\u3063\u3066\u5fc5\u305a\u518d\u53d6\u5f97\u304c\u884c\u308f\u308c\u308b\u308f\u3051\u3067\u306f\u306a\u3044\u3067\u3059\u3002\u305f\u3060\u3001\u3053\u306e\u30aa\u30d7\u30b7\u30e7\u30f3\u3092\u4f7f\u3048\u3070\u5f37\u5236\u7684\u306b\u30ad\u30e3\u30c3\u30b7\u30e5\u306e\u518d\u53d6\u5f97\u3092\u884c\u308f\u305b [&hellip;]","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[122],"tags":[],"_links":{"self":[{"href":"http:\/\/www.code-magagine.com\/index.php?rest_route=\/wp\/v2\/posts\/22817"}],"collection":[{"href":"http:\/\/www.code-magagine.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.code-magagine.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.code-magagine.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.code-magagine.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=22817"}],"version-history":[{"count":16,"href":"http:\/\/www.code-magagine.com\/index.php?rest_route=\/wp\/v2\/posts\/22817\/revisions"}],"predecessor-version":[{"id":23121,"href":"http:\/\/www.code-magagine.com\/index.php?rest_route=\/wp\/v2\/posts\/22817\/revisions\/23121"}],"wp:attachment":[{"href":"http:\/\/www.code-magagine.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=22817"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.code-magagine.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=22817"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.code-magagine.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=22817"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}