{"id":859,"date":"2023-06-06T21:05:15","date_gmt":"2023-06-06T12:05:15","guid":{"rendered":"https:\/\/blog.srytk.com\/aquei\/?p=859"},"modified":"2023-06-06T21:05:18","modified_gmt":"2023-06-06T12:05:18","slug":"wordpress%e3%83%96%e3%83%ad%e3%82%b0%e3%82%92cloudflare%e3%81%ab%e3%82%ad%e3%83%a3%e3%83%83%e3%82%b7%e3%83%a5%e3%81%95%e3%81%9b%e3%81%a4%e3%81%a4activitypub%e3%81%a7%e9%85%8d%e4%bf%a1%e3%81%99","status":"publish","type":"post","link":"https:\/\/blog.srytk.com\/aquei\/859.html","title":{"rendered":"WordPress\u30d6\u30ed\u30b0\u3092Cloudflare\u306b\u30ad\u30e3\u30c3\u30b7\u30e5\u3055\u305b\u3064\u3064ActivityPub\u3067\u914d\u4fe1\u3059\u308b"},"content":{"rendered":"\n<p>\u5148\u65e5\u3001<a href=\"https:\/\/blog.srytk.com\/aquei\/842.html\">Cloudflare\u3068ActivityPub\u30d7\u30e9\u30b0\u30a4\u30f3\u306f\u6df7\u305c\u308b\u306a\u5371\u967a\uff1f\u30ad\u30e3\u30c3\u30b7\u30e5\u306b\u8981\u6ce8\u610f<\/a>\u3068\u3044\u3046\u8a18\u4e8b\u3092\u66f8\u3044\u305f\u3002\u304b\u3044\u3064\u307e\u3093\u3067\u8aac\u660e\u3059\u308b\u3068\u3001ActivityPub\u3067\u914d\u4fe1\u3057\u3066\u3044\u305fJSON\u304cCloudflare CDN\u306b\u30ad\u30e3\u30c3\u30b7\u30e5\u3055\u308c\u3066\u3057\u307e\u3044\u3001\u30d6\u30e9\u30a6\u30b6\u3067\u30d6\u30ed\u30b0\u306b\u30a2\u30af\u30bb\u30b9\u3059\u308b\u3068\u8a18\u4e8b\u304c\u8868\u793a\u3055\u308c\u306a\u304f\u3066\u56f0\u3063\u305f\u3001\u3068\u3044\u3046\u5185\u5bb9\u3060\u3002\u3053\u306e\u6642\u306fCDN\u30ad\u30e3\u30c3\u30b7\u30e5\u3092\u7121\u52b9\u306b\u3059\u308b\u3053\u3068\u3067\u51cc\u3044\u3060\u304c\u3001\u30ad\u30e3\u30c3\u30b7\u30e5\u3068ActivityPub\u3092\u4e21\u7acb\u3059\u308b\u4e0a\u624b\u3044\u89e3\u6c7a\u6cd5\u3092\u898b\u3064\u3051\u305f\uff08\u304b\u3082\u3057\u308c\u306a\u3044\uff09\u306e\u3067\u7d39\u4ecb\u3057\u3066\u304a\u304f\u3002<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>\u901a\u5e38\u306e\u30d6\u30e9\u30a6\u30b6\u304b\u3089\u306e\u30a2\u30af\u30bb\u30b9<strong>\u306e\u307f<\/strong>\u30ad\u30e3\u30c3\u30b7\u30e5\u3055\u305b\u308b<\/li>\n\n\n\n<li><a href=\"https:\/\/developers.cloudflare.com\/cache\/how-to\/cache-rules\/\">Cloudflare\u306eCache Rules<\/a>\u3092\u7528\u3044\u3066\u30d6\u30e9\u30a6\u30b6\u4ee5\u5916\u306e\u30a2\u30af\u30bb\u30b9\u306f\u30ad\u30e3\u30c3\u30b7\u30e5\u3092\u30d0\u30a4\u30d1\u30b9\u3059\u308b<\/li>\n<\/ol>\n\n\n\n<p>\u3053\u306e\u65b9\u6cd5\u3060\u3068\u4e0a\u624b\u304f\u3044\u304f\u6c17\u304c\u3059\u308b\u3002<\/p>\n\n\n\n<p>\u307e\u305a\u30011\u306e\u300c\u901a\u5e38\u306e\u30d6\u30e9\u30a6\u30b6\u304b\u3089\u306e\u30a2\u30af\u30bb\u30b9\u306e\u307f\u30ad\u30e3\u30c3\u30b7\u30e5\u3055\u305b\u308b\u300d\u306b\u3064\u3044\u3066\u3002ActivityPub\u3067\u914d\u4fe1\u3057\u3066\u3044\u308bActivity Streams 2.0\u306eJSON\u306f\u30ad\u30e3\u30c3\u30b7\u30e5\u3055\u308c\u308b\u3068\u56f0\u308b\u304c\u901a\u5e38\u306eHTML\u306fCDN\u306b\u30ad\u30e3\u30c3\u30b7\u30e5\u3057\u3066\u307b\u3057\u3044\u3002\u305d\u3053\u3067\u30d6\u30ed\u30b0\u3078\u306e\u30ea\u30af\u30a8\u30b9\u30c8\u304cActivityPub\u306b\u3088\u308b\u3082\u306e\u304b\u3001\u901a\u5e38\u306e\u30a2\u30af\u30bb\u30b9\u306a\u306e\u304b\u3092\u5224\u5b9a\u3057\u3066\u9069\u5207\u306a<a href=\"https:\/\/developer.mozilla.org\/ja\/docs\/Web\/HTTP\/Headers\/Cache-Control\">Cache-Control<\/a>\u3092\u8a2d\u5b9a\u3059\u308b\u5fc5\u8981\u304c\u3042\u308b\u3002ActivitiyPub\u306b\u3088\u308b\u30ea\u30af\u30a8\u30b9\u30c8\u306fAccept\u30d8\u30c3\u30c0\u30fc\u306bapplication\/ld+json; profile=&#8221;https:\/\/www.w3.org\/ns\/activitystreams&#8221;\u3084application\/activity+json\u3067<a href=\"https:\/\/www.w3.org\/TR\/activitypub\/#retrieving-objects\">\u30ea\u30af\u30a8\u30b9\u30c8\u3055\u308c\u308b\u3089\u3057\u3044<\/a>\u304b\u3089Accept\u30d8\u30c3\u30c0\u30fc\u3092\u898b\u308b\u3068\u826f\u3055\u305d\u3046\u3060\u3002\u7c21\u5358\u306a\u4f8b\u3092\u6319\u3052\u308b\u3068\u3053\u3093\u306a\u611f\u3058\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&lt;?php\nif (isset($_SERVER&#91;'HTTP_ACCEPT'])) {\n\t$ha = strtolower($_SERVER&#91;'HTTP_ACCEPT']);\n\tif (strpos($ha, 'application\/ld+json') !== false || strpos($ha, 'application\/activity+json') !== false) {\n\t\t#\u30ad\u30e3\u30c3\u30b7\u30e5\u3055\u305b\u306a\u3044\n\t\theader('Cache-Control: private, must-revalidate, no-cache');\n\t} else {\n\t\t#\u30ad\u30e3\u30c3\u30b7\u30e5\u3055\u305b\u308b\n\t\theader('Cache-Control: max-age=1800, public');\n\t}\n}<\/code><\/pre>\n\n\n\n<p>CDN\u306e\u30ad\u30e3\u30c3\u30b7\u30e5\u30b3\u30f3\u30c8\u30ed\u30fc\u30eb\u306f\u81ea\u524d\u306e\u30d7\u30e9\u30b0\u30a4\u30f3\u3067\u3084\u3063\u3066\u3044\u305f\u306e\u3067\u554f\u984c\u306a\u304b\u3063\u305f\u304c\u3001\u65e2\u5b58\u306e\u30ad\u30e3\u30c3\u30b7\u30e5\u7cfb\u306e\u30d7\u30e9\u30b0\u30a4\u30f3\u3092\u4f7f\u3063\u3066\u3044\u308b\u4eba\u306f<a href=\"https:\/\/developer.wordpress.org\/reference\/hooks\/wp_headers\/\">wp_headers<\/a>\u3092hook\u3059\u308c\u3070\u826f\u3055\u305d\u3046\u3060\u3002<\/p>\n\n\n\n<p>\u305d\u3057\u3066\u30012\u306e\u300cCloudflare\u306eCache Rules\u3092\u7528\u3044\u3066\u30d6\u30e9\u30a6\u30b6\u4ee5\u5916\u306e\u30a2\u30af\u30bb\u30b9\u306f\u30ad\u30e3\u30c3\u30b7\u30e5\u3092\u30d0\u30a4\u30d1\u30b9\u3059\u308b\u300d\u306b\u3064\u3044\u3066\u3002Cache Rules\u3068\u306fCookie\u3084URI\u306a\u3069\u306e\u5024\u3092\u6761\u4ef6\u306b\u30ad\u30e3\u30c3\u30b7\u30e5\u304c\u6709\u52b9\u306a\u671f\u9593\u3092\u8a2d\u5b9a\u3057\u305f\u308a\u3001\u4e00\u6642\u7684\u306b\u30ad\u30e3\u30c3\u30b7\u30e5\u3092\u7121\u52b9\u5316\u3057\u305f\u308a\u3067\u304d\u308b\u6a5f\u80fd\u306e\u3088\u3046\u3060\u3002\u5b09\u3057\u3044\u3053\u3068\u306b\u7121\u6599\u30e6\u30fc\u30b6\u30fc\u3067\u308210\u4ef6\u306e\u30eb\u30fc\u30eb\u304c\u4f5c\u6210\u3067\u304d\u308b\u3002<\/p>\n\n\n\n<p>\u3055\u3066\u3001\u4e0a\u8a18\u306e1\u3067\u65e2\u306bHTML\u3092\u30ad\u30e3\u30c3\u30b7\u30e5\u3057\u3066\u3044\u308b\u306f\u305a\u306a\u306e\u3067\u3001ActivityPub\u3067\u306e\u30ea\u30af\u30a8\u30b9\u30c8\u3067\u306f\u3053\u306e\u30ad\u30e3\u30c3\u30b7\u30e5\u3092\u7121\u8996\u3057\u3066\u65b0\u3057\u304f\u30aa\u30ea\u30b8\u30f3(WordPress)\u306b\u30a2\u30af\u30bb\u30b9\u3057\u3066\u307b\u3057\u3044\u3002\u6b8b\u5ff5\u306a\u3053\u3068\u306bCache Rules\u3067\u306fAccept\u30d8\u30c3\u30c0\u30fc\u3092\u6761\u4ef6\u306b\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u306a\u3044\u306e\u3067\u3001User Agent\u3067\u5224\u65ad\u3059\u308b\u3053\u3068\u306b\u3057\u305f\u3002\u3064\u307e\u308a\u3001\u901a\u5e38\u306e\u30d6\u30e9\u30a6\u30b6\u304b\u3089\u306e\u30a2\u30af\u30bb\u30b9\u3068\u533a\u5225\u3059\u308b\u305f\u3081\u306bUser-Agent\u306b\u300cMozilla\/5.0\u300d\u3092\u542b\u307e\u306a\u3044\u30a2\u30af\u30bb\u30b9\u3067\u306f\u30ad\u30e3\u30c3\u30b7\u30e5\u3092\u4e00\u6642\u7684\u306b\u7121\u52b9\u306b\u3059\u308b\u3053\u3068\u306b\u3057\u305f\u3002\u3061\u306a\u307f\u306b\u6b74\u53f2\u7684\u7d4c\u7def\u306b\u3088\u308a\u3001\u4e00\u822c\u7684\u306b\u4f7f\u308f\u308c\u3066\u3044\u308b\u30d6\u30e9\u30a6\u30b6\u306f<strong>\u5168\u3066<\/strong><a href=\"https:\/\/developer.mozilla.org\/ja\/docs\/Web\/HTTP\/Headers\/User-Agent\/Firefox#%E5%85%A8%E8%88%AC%E7%9A%84%E3%81%AA%E5%BD%A2%E5%BC%8F\">\u300cMozilla\/5.0\u300d\u304b\u3089\u59cb\u307e\u3063\u3066\u3044\u308b<\/a>\u3002<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"522\" height=\"724\" src=\"https:\/\/blog.srytk.com\/aquei\/wp-content\/uploads\/sites\/5\/2023\/06\/cf_rule.webp\" alt=\"cache rules\u306e\u8a2d\u5b9a\u753b\u9762 \u30d6\u30e9\u30a6\u30b6\u304b\u3089\u306e\u30a2\u30af\u30bb\u30b9\u4ee5\u5916\u306f\u30ad\u30e3\u30c3\u30b7\u30e5\u3092\u30d0\u30a4\u30d1\u30b9\u3057\u3066\u3044\u308b\" class=\"wp-image-862\"\/><\/figure>\n\n\n\n<p>\u3053\u306e\u3088\u3046\u306b\u8a2d\u5b9a\u3057\u3001\u30d6\u30e9\u30a6\u30b6\u4ee5\u5916\u304b\u3089\u306e\u30ea\u30af\u30a8\u30b9\u30c8\u306f\u30ad\u30e3\u30c3\u30b7\u30e5\u3092\u30d0\u30a4\u30d1\u30b9\u3059\u308b\u3053\u3068\u3067\u5b89\u5168\u306bHTML\u3092\u30ad\u30e3\u30c3\u30b7\u30e5\u3067\u304d\u308b\u306f\u305a\u3060\u3002\u3061\u306a\u307f\u306b\u300cMozilla\/5.0\u300d\u3092\u542b\u3080User-Agent\u3067ActivityPub\u3067\u306e\u30a2\u30af\u30bb\u30b9\u304c\u3042\u308b\u3068\u3046\u307e\u304f\u52d5\u4f5c\u3057\u306a\u3044\u3053\u3068\u306b\u306a\u308b\u3002\u30b5\u30fc\u30d0\u30fc\u3084bot\u304b\u3089\u306e\u30a2\u30af\u30bb\u30b9\u3067\u30d6\u30e9\u30a6\u30b6\u306b\u507d\u88c5\u3059\u308b\u610f\u5473\u306f\u306a\u3055\u305d\u3046\u306a\u306e\u3067\u5927\u4e08\u592b\u3060\u3068\u601d\u3046\u304c\u3001\u5c06\u6765\u304c\u4e0d\u78ba\u5b9f\u3067\u30e2\u30e4\u30e2\u30e4\u3059\u308b\u3002\u30ed\u30b0\u3092\u8abf\u3079\u305f\u3068\u3053\u308d\u3001\u5c11\u306a\u304f\u3068\u3082\u30de\u30b9\u30c8\u30c9\u30f3\u306e\u30b5\u30fc\u30d0\u30fc\u304b\u3089\u306e\u30a2\u30af\u30bb\u30b9\u3067\u306f&#8221;http.rb\/4.4.1 (Mastodon\/3.4.1 Fedibird\/0.1; +https:\/\/fedibird.com\/)&#8221;\u306e\u3088\u3046\u306bUser-Agent\u304c\u8a2d\u5b9a\u3055\u308c\u3066\u3044\u305f\u3002<\/p>\n\n\n\n<p>\u8a2d\u5b9a\u304c\u7d42\u308f\u3063\u305f\u3089\u5b9f\u969b\u306b\u30a2\u30af\u30bb\u30b9\u3057\u3066\u30c6\u30b9\u30c8\u3057\u3066\u307f\u305f\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$ { curl -H 'User-Agent: Mozilla\/5.0 (Windows NT 10.0; Win64; x64; rv:109.0) Gecko\/20100101 Firefox\/113.0' -I https:\/\/blog.srytk.com\/aquei\/851.html 2>\/dev\/null; curl -H 'User-Agent: I AM BOT !!!!' -H 'Accept:\napplication\/ld+json; profile=\"https:\/\/www.w3.org\/ns\/activitystreams\"' -I https:\/\/blog.srytk.com\/aquei\/851.html 2>\/dev\/null; } | grep CF-Cache\nCF-Cache-Status: HIT\nCF-Cache-Status: DYNAMIC<\/code><\/pre>\n\n\n\n<p>\u30d6\u30ed\u30b0\u8a18\u4e8b\u306b\u30d6\u30e9\u30a6\u30b6\u306eUser-Agent\u3067\u30a2\u30af\u30bb\u30b9\u3059\u308b\u3068Cloudflare\u306e\u30ad\u30e3\u30c3\u30b7\u30e5\u304b\u3089\u914d\u4fe1\u3055\u308c\u3066\u3044\u308b\u304c\u3001&#8221;I AM BOT !!!!&#8221;\u3068\u3044\u3046User-Agent\u3067ActivityPub\u3067\u30a2\u30af\u30bb\u30b9\u3059\u308b\u3068<a href=\"https:\/\/developers.cloudflare.com\/cache\/concepts\/default-cache-behavior\/#cloudflare-cache-responses\">DYNAMIC<\/a>\u3001\u3064\u307e\u308aWordpress\u304b\u3089\u30b3\u30f3\u30c6\u30f3\u30c4\u304c\u518d\u53d6\u5f97\u3055\u308c\u305f\u3002\u3046\u3093\u3001\u3053\u308c\u306f\u3046\u307e\u304f\u3044\u304d\u305d\u3046\u3060\u3002\u3053\u306e\u8a18\u4e8b\u3067\u5b9f\u969b\u306b\u6295\u7a3f\u3057\u3066\u307f\u3066\u3046\u307e\u304f\u52d5\u304f\u304b\u30c6\u30b9\u30c8\u3057\u3066\u307f\u3088\u3046\u3002\u3046\u307e\u304f\u3044\u304f\u3068\u3044\u3044\u306a\uff01<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u5148\u65e5\u3001Cloudflare\u3068ActivityPub\u30d7\u30e9\u30b0\u30a4\u30f3\u306f\u6df7\u305c\u308b\u306a\u5371\u967a\uff1f\u30ad\u30e3\u30c3\u30b7\u30e5\u306b\u8981\u6ce8\u610f\u3068\u3044\u3046\u8a18\u4e8b\u3092\u66f8\u3044\u305f\u3002\u304b\u3044\u3064\u307e\u3093\u3067\u8aac\u660e\u3059\u308b\u3068\u3001ActivityPub\u3067\u914d\u4fe1\u3057\u3066\u3044\u305fJSON\u304cCloudflare CDN\u306b\u30ad\u30e3\u30c3 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"activitypub_content_warning":"","activitypub_content_visibility":"local","activitypub_max_image_attachments":5,"footnotes":""},"categories":[2],"tags":[281,17,3],"class_list":["post-859","post","type-post","status-publish","format-standard","hentry","category-tech","tag-activitypub","tag-cloudflare","tag-wordpress"],"_links":{"self":[{"href":"https:\/\/blog.srytk.com\/aquei\/wp-json\/wp\/v2\/posts\/859","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.srytk.com\/aquei\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.srytk.com\/aquei\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.srytk.com\/aquei\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.srytk.com\/aquei\/wp-json\/wp\/v2\/comments?post=859"}],"version-history":[{"count":4,"href":"https:\/\/blog.srytk.com\/aquei\/wp-json\/wp\/v2\/posts\/859\/revisions"}],"predecessor-version":[{"id":864,"href":"https:\/\/blog.srytk.com\/aquei\/wp-json\/wp\/v2\/posts\/859\/revisions\/864"}],"wp:attachment":[{"href":"https:\/\/blog.srytk.com\/aquei\/wp-json\/wp\/v2\/media?parent=859"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.srytk.com\/aquei\/wp-json\/wp\/v2\/categories?post=859"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.srytk.com\/aquei\/wp-json\/wp\/v2\/tags?post=859"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}