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

ignoreRedirects fails due to missing host in the certificate's altname #125

Closed
amimas opened this issue Nov 27, 2019 · 3 comments · Fixed by #126
Closed

ignoreRedirects fails due to missing host in the certificate's altname #125

amimas opened this issue Nov 27, 2019 · 3 comments · Fixed by #126

Comments

@amimas
Copy link

amimas commented Nov 27, 2019

Hi,

I was using the version 4.4.1 and trying to upgrade to the latest version (4.6.1). After the upgrade, I'm getting the following link being reported as dead:

https://www.consul.io/intro/getting-started/kv.html

The above link is being redirected to:

https://learn.hashicorp.com/consul/getting-started/kv.html

I already have ignoreRedirects to true and other links that are being redirected are ignored properly. The error returned by textlint is:

 13:124  error  https://www.consul.io/intro/getting-started/kv.html is dead. (request to https://learn.hashicorp.com/consul/getting-started/kv.html failed, reason: Hostname/IP does not match certificate's altnames: Host: www.consul.io. is not in the cert's altnames: DNS:*.netlify.com, DNS:netlify.com)  no-dead-link

When I use a curl command to test that link, I get a 301 redirect status code and no other errors:

$ curl -I -H "Host: www.consul.io" -H "User-Agent: textlint-no-dead-link" -H "Accept: */*" https://www.consul.io/intro/getting-started/kv.html
HTTP/2 301 
retry-after: 0
location: https://learn.hashicorp.com/consul/getting-started/kv.html
strict-transport-security: max-age=31536000; includeSubdomains; preload
accept-ranges: bytes
date: Wed, 27 Nov 2019 18:04:42 GMT
content-length: 0

It seems the issue didn't exist when I was using version 4.4.1.

@azu azu added the Type: Bug label Nov 28, 2019
azu added a commit that referenced this issue Nov 28, 2019
Always set valid HOST for `fetch`'s url.

fix #125
@azu azu closed this as completed in #126 Nov 28, 2019
azu added a commit that referenced this issue Nov 28, 2019
* chore(deps): update textlint-script@3

* fix: avoid ERR_TLS_CERT_ALTNAME_INVALID when redirected url

Always set valid HOST for `fetch`'s url.

fix #125

* chore: remove log

* test: --no-timeout

* test: remove --no-timeout
@azu
Copy link
Member

azu commented Nov 29, 2019

@amimas
Copy link
Author

amimas commented Nov 29, 2019

Thanks @azu for the quick fix. I will try to test it out soon. I do have a question about the fix though.

In the PR #126, if I'm not mistaken, I noticed the host name is being updated to the new URL that is being redirected to. I'm curious why we need to that in the first place.

If I marked https://example.com to be ignored if it's being redirected, why does the linter need to validate new url (https://new.example.com)? As soon as we get a 30x status code from the original URL, why don't we just stop there?

Did I mis-interpret the changes in that PR?

@amimas
Copy link
Author

amimas commented Dec 2, 2019

@azu - When you get a chance, could you please clarify the above? ☝️

Thanks,

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

Successfully merging a pull request may close this issue.

2 participants