Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

403 for github.com because it blocks requests without --compressed curl flag #201

Open
dg-nvm opened this issue Apr 25, 2022 · 5 comments
Open

Comments

@dg-nvm
Copy link

dg-nvm commented Apr 25, 2022

λ docker run --rm -v <PATH>:/directory -w /directory ghcr.io/tcort/markdown-link-check:latest doc/TODO.md

FILE: doc/TODO.md
  [✖] https://docs.github.com/en/repositories/managing-your-repositorys-settings-and-features/customizing-your-repository/about-code-owners

  1 links checked.

  ERROR: 1 dead links found!
  [✖] https://docs.github.com/en/repositories/managing-your-repositorys-settings-and-features/customizing-your-repository/about-code-owners → Status: 403

Local curl:

λ C:\Users\dawid.goslawski\scoop\shims\curl.exe -f https://docs.github.com/en/repositories/managing-your-repositorys-settings-and-features/customizing-your-repository/about-code-owners -o nul
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
curl: (22) The requested URL returned error: 403

Curl with --compressed:

λ C:\Users\dawid.goslawski\scoop\shims\curl.exe --silent --compressed -f https://docs.github.com/en/repositories/managing-your-repositorys-settings-and-features/customizing-your-repository/about-code-owners -o nul && echo "OK"
"OK"
@brandones
Copy link
Contributor

As a workaround, you can add the following to the config file:

  "httpHeaders": [
    {
      "urls": ["https://docs.github.com/"],
      "headers": {
        "Accept-Encoding": "zstd, br, gzip, deflate"
      }
    }
  ]

as seen here: https://github.com/openmrs/openmrs-esm-core/pull/412/files

@josecelano
Copy link

Would be a good option to add the header "Accept-Encoding: zstd, br, gzip, deflate" by default? I suppose the response body is not used. I assume you only check the response code.

I know this is a specific case (because GitHub requires that header) but I do not see any side effects for other cases.

@PeterDaveHello
Copy link
Contributor

PeterDaveHello commented Jun 16, 2022

The workaround provided by @brandones works on non-redirected links 👍
For those links with 301/302 redirection, will still get 403 and end up in dead status here 😅 (I missed one domain in the config, please forgive me 😅)

Set those accepted compression(encoding) header as default looks good to me and may be the solution 😄

shiranr added a commit to microsoft/code-with-engineering-playbook that referenced this issue Jun 19, 2022
PeterDaveHello added a commit to PeterDaveHello/docker-node that referenced this issue Jun 20, 2022
PeterDaveHello added a commit to PeterDaveHello/docker-node that referenced this issue Jun 21, 2022
@gwarf
Copy link

gwarf commented Jun 22, 2022

See also github/docs#17358

gwarf added a commit to EGI-Federation/SVG-advisories that referenced this issue Jun 22, 2022
alrra added a commit to alrra/dotfiles that referenced this issue Jul 1, 2022
Without the "Accept-Encoding" HTTP header GitHub blocks the requests
made to "help.github.com".

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

See also:

* github/docs#17358
* tcort/markdown-link-check#201
alrra added a commit to alrra/browser-logos that referenced this issue Jul 2, 2022
Without the "Accept-Encoding" HTTP header GitHub blocks the requests
made to "help.github.com".

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

See also:

* github/docs#17358
* tcort/markdown-link-check#201
shiranr added a commit to microsoft/code-with-engineering-playbook that referenced this issue Aug 17, 2022
* Add mega linter

* Add workflow for mega linter

* change the mega linter check

* Remove trailing spaces

* Disable HTML and Docker file linters

* Disable JSON linters

* fix reviewers.yml

* Disable cspell
Small fixes the mega linter did

* Disable cspell errors to warnings for now

* push linter fixes

* fix 403 issues with links from GH and other sites.
Workaround: tcort/markdown-link-check#201

* fix links

* Remove internal links

* Delete markdownlint.yml

* Fix linting for mkdocs.yml

* Disable old linter

* Fix broken links

* Fix broken links

* Remove mega linter

* Fix broken links

* Fix broken links

* fix broken links

* Remove uneeded spell checks from the cspell config

* Keep fixing cspell stopped at: overfitting

* Keep fixing cspell stopped at: overfitting

* Update package lock.

* fix documentation

* ignore failing working link

* fix spell

* Add 302 as alive status code

* Upgrade mega linter to version 6

* Update to version 6

update to version 6 of mega linter

* Update megalinter

* remove blank line

* Fix file

* change root user for Dockerfile

* revert

* Change the use of root user in the dockerfile

* ignore trivy error for docker root user

* remove unneeded spaces

* Update .github/workflows/mega-linter.yml

Co-authored-by: Tomi Paananen <[email protected]>

* Update docs/continuous-delivery/secrets-management/README.md

Co-authored-by: Tomi Paananen <[email protected]>

* Update docs/continuous-delivery/secrets-management/README.md

Co-authored-by: Tomi Paananen <[email protected]>

* Update docs/agile-development/basics/Ceremonies/README.md

Co-authored-by: Tomi Paananen <[email protected]>

* Update .projector/workItemTemplates/kubernetes-at-the-edge.yml

Co-authored-by: Tomi Paananen <[email protected]>

* Update .projector/workItemTemplates/kubernetes-at-the-edge.yml

Co-authored-by: Tomi Paananen <[email protected]>

* Update docs/observability/pillars/dashboard.md

Co-authored-by: Tomi Paananen <[email protected]>

Co-authored-by: Tomi Paananen <[email protected]>
sadra-barikbin added a commit to sadra-barikbin/serve that referenced this issue Oct 13, 2022
msaroufim added a commit to pytorch/serve that referenced this issue Oct 13, 2022
* Add linting steps to doc-automation workflow

* Move changes to lint.yml

* Some improvements

* Fix bug

* Some enhancements

* Fix bug

* Fix some links, a few typos and also linting steps

* Fix intel-extension links and some others

* Fix some typos

* Fix remaining typos

* Fix some other links

* Fix bug

* Add some words to wordllist.txt

* Add some other words to wordlist.txt

* Fix some links and improve markdown-lin-check config

* Fix bug

* Temporary fix a link

* Fix 4 remaining links

* Fix typos

* Fix typos

* Fix bug

* Improve spellcheck and fix misspellings

* Clean wordlist.txt abit

* Fix GitHub 403 errors

From tcort/markdown-link-check#201 (comment)

* Fix md-link-check version

* Fix a link

Co-authored-by: Mark Saroufim <[email protected]>
thanethomson added a commit to tendermint/tendermint that referenced this issue Oct 31, 2022
thanethomson added a commit to tendermint/tendermint that referenced this issue Oct 31, 2022
thanethomson added a commit to tendermint/tendermint that referenced this issue Oct 31, 2022
* ci: Run Markdown link checker nightly

Signed-off-by: Thane Thomson <[email protected]>

* ci: Switch to Informal Systems fork of link checker

Signed-off-by: Thane Thomson <[email protected]>

* Update link checker config to work with GitHub

As per tcort/markdown-link-check#201 (comment)

Signed-off-by: Thane Thomson <[email protected]>

Signed-off-by: Thane Thomson <[email protected]>
jagadeeshi2i pushed a commit to jagadeeshi2i/serve that referenced this issue Nov 1, 2022
* Add linting steps to doc-automation workflow

* Move changes to lint.yml

* Some improvements

* Fix bug

* Some enhancements

* Fix bug

* Fix some links, a few typos and also linting steps

* Fix intel-extension links and some others

* Fix some typos

* Fix remaining typos

* Fix some other links

* Fix bug

* Add some words to wordllist.txt

* Add some other words to wordlist.txt

* Fix some links and improve markdown-lin-check config

* Fix bug

* Temporary fix a link

* Fix 4 remaining links

* Fix typos

* Fix typos

* Fix bug

* Improve spellcheck and fix misspellings

* Clean wordlist.txt abit

* Fix GitHub 403 errors

From tcort/markdown-link-check#201 (comment)

* Fix md-link-check version

* Fix a link

Co-authored-by: Mark Saroufim <[email protected]>
jagadeeshi2i pushed a commit to jagadeeshi2i/serve that referenced this issue Nov 3, 2022
* Add linting steps to doc-automation workflow

* Move changes to lint.yml

* Some improvements

* Fix bug

* Some enhancements

* Fix bug

* Fix some links, a few typos and also linting steps

* Fix intel-extension links and some others

* Fix some typos

* Fix remaining typos

* Fix some other links

* Fix bug

* Add some words to wordllist.txt

* Add some other words to wordlist.txt

* Fix some links and improve markdown-lin-check config

* Fix bug

* Temporary fix a link

* Fix 4 remaining links

* Fix typos

* Fix typos

* Fix bug

* Improve spellcheck and fix misspellings

* Clean wordlist.txt abit

* Fix GitHub 403 errors

From tcort/markdown-link-check#201 (comment)

* Fix md-link-check version

* Fix a link

Co-authored-by: Mark Saroufim <[email protected]>
EricGao888 pushed a commit to EricGao888/dolphinscheduler that referenced this issue Nov 7, 2022
see more detail in
tcort/markdown-link-check#201
and we find can solve this by adding `httpHeaders` to fix
it
pabloest added a commit to semgrep/semgrep-docs that referenced this issue Nov 11, 2022
pabloest added a commit to semgrep/semgrep-docs that referenced this issue Nov 14, 2022
* Remove outdated instructions

following: https://github.com/returntocorp/ocaml-tree-sitter-languages/blob/main/doc/adding-a-language.md

* Use compression headers for markdown link checks when querying GitHub sites

per: tcort/markdown-link-check#201
aidanheerdegen added a commit to ACCESS-NRI/access-hive.org.au that referenced this issue Nov 18, 2022
bcanseco added a commit to bcanseco/github-contribution-graph-action that referenced this issue Dec 11, 2022
bcanseco added a commit to bcanseco/github-contribution-graph-action that referenced this issue Dec 11, 2022
bcanseco added a commit to bcanseco/github-contribution-graph-action that referenced this issue Dec 11, 2022
gwarf added a commit to gwarf/repository-template that referenced this issue Jan 5, 2023
gwarf added a commit to EGI-Federation/repository-template that referenced this issue Jan 6, 2023
- No more reference community.egi.eu
- Fix black documentation link
- Fix markdown-link-check errors with docs.github.com. See
tcort/markdown-link-check#201.
- Add markdownlint config file
- Prepare for running workflows only on PR
gwarf added a commit to EGI-Federation/documentation that referenced this issue Jan 9, 2023
gwarf added a commit to EGI-Federation/documentation that referenced this issue Jan 9, 2023
werrett pushed a commit to semgrep/semgrep-docs that referenced this issue Jan 10, 2023
* Remove outdated instructions

following: https://github.com/returntocorp/ocaml-tree-sitter-languages/blob/main/doc/adding-a-language.md

* Use compression headers for markdown link checks when querying GitHub sites

per: tcort/markdown-link-check#201
werrett pushed a commit to semgrep/semgrep-docs that referenced this issue Jan 10, 2023
* Remove outdated instructions

following: https://github.com/returntocorp/ocaml-tree-sitter-languages/blob/main/doc/adding-a-language.md

* Use compression headers for markdown link checks when querying GitHub sites

per: tcort/markdown-link-check#201
wingy3181 added a commit to wingy3181/dotfiles that referenced this issue Nov 27, 2023
…ory and rename it to scripts

✅ Send "Accept-Encoding" HTTP header when checking "help.github.com"
Without the "Accept-Encoding" HTTP header GitHub blocks the requests
made to "help.github.com".

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

See also:

* github/docs#17358
* tcort/markdown-link-check#201

See alrra@a3433f8
See alrra@4dc75ad
See alrra@4ab15e9
wingy3181 added a commit to wingy3181/dotfiles that referenced this issue Nov 27, 2023
…ory and rename it to scripts

✅ Send "Accept-Encoding" HTTP header when checking "help.github.com"
Without the "Accept-Encoding" HTTP header GitHub blocks the requests
made to "help.github.com".

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

See also:

* github/docs#17358
* tcort/markdown-link-check#201

See alrra@a3433f8
See alrra@4dc75ad
See alrra@4ab15e9
@MikeMcC399
Copy link

The original issue that github.com was returning an HTTP 403 forbidden is no longer occurring. The debug steps to reproduce from the original post are now succeeding instead of failing:

curl -f https://docs.github.com/en/repositories/managing-your-repositorys-settings-and-features/customizing-your-repository/about-code-owners -o nul
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  231k  100  231k    0     0   938k      0 --:--:-- --:--:-- --:--:--  942k

So it seems that the workaround described in #201 (comment)

  "httpHeaders": [
    {
      "urls": ["https://docs.github.com/"],
      "headers": {
        "Accept-Encoding": "zstd, br, gzip, deflate"
      }
    }
  ]

is no longer necessary.

Would anybody like to cross-check?

I implemented the workaround 2 years ago. Now, due to the fact that [email protected] (current latest) seems to have broken the config file function (see #369), I checked what happened without a config file and was surprised to find that everything worked without it!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants
@josecelano @gwarf @brandones @PeterDaveHello @dg-nvm @MikeMcC399 and others