From f8b2d5cc1a2ba23c9116215b7845f803613705c9 Mon Sep 17 00:00:00 2001 From: per1234 Date: Sun, 29 May 2022 09:50:11 -0700 Subject: [PATCH] Configure link check to use `Accept-Encoding` header for docs.github.com links The link check job of the "Check Markdown" workflow has had frequent intermittent spurious failures recently, caused by links under the docs.github.com domain returning 403 HTTP status. Others experiencing the same problem reported that they were able to work around the problem by providing a custom `Accept-Encoding` HTTP request header. Although I was not able to find any explanation of why, it does appear to resolve the problem. Since the problem seems to be permanent and the only other workarounds I have identified are unappealing (considering links returning 403 statuses alive, or ignoring all docs.github.com links), I think it is worth a try. --- .markdown-link-check.json | 8 ++++++++ .../assets/check-markdown/.markdown-link-check.json | 8 ++++++++ 2 files changed, 16 insertions(+) diff --git a/.markdown-link-check.json b/.markdown-link-check.json index fe469df2..ea266716 100644 --- a/.markdown-link-check.json +++ b/.markdown-link-check.json @@ -1,4 +1,12 @@ { + "httpHeaders": [ + { + "urls": ["https://docs.github.com/"], + "headers": { + "Accept-Encoding": "gzip, deflate, br" + } + } + ], "retryOn429": true, "retryCount": 3, "aliveStatusCodes": [200, 206], diff --git a/workflow-templates/assets/check-markdown/.markdown-link-check.json b/workflow-templates/assets/check-markdown/.markdown-link-check.json index da798797..c5e178dd 100644 --- a/workflow-templates/assets/check-markdown/.markdown-link-check.json +++ b/workflow-templates/assets/check-markdown/.markdown-link-check.json @@ -1,4 +1,12 @@ { + "httpHeaders": [ + { + "urls": ["https://docs.github.com/"], + "headers": { + "Accept-Encoding": "gzip, deflate, br" + } + } + ], "retryOn429": true, "retryCount": 3, "aliveStatusCodes": [200, 206]