gjtorikian / html-proofer

Test your rendered HTML files to make sure they're accurate.
MIT License
1.57k stars 196 forks source link

Error for http only sites #799

Closed RichardLitt closed 1 year ago

RichardLitt commented 1 year ago

I get the following error:

* At ./_site/projects/access-land/index.html:70:

  http://accessland.org is not an HTTPS link

For that site, there is no HTTPS enabled. Should this be flagged?

riccardoporreca commented 1 year ago

@RichardLitt, the enforce_https option can be used to control this.

For the command line (htmlproofer --help):

        --[no-]enforce-https         Fails a link if it's not marked as `https` (default: `true`).
RichardLitt commented 1 year ago

I think that's different than failing of the link doesn't have an HTTPS equivalent. Right now, the flag itself is an error, because the link is correct.

riccardoporreca commented 1 year ago

@RichardLitt let me try to clarify the behavior.

The way html-proofer behaves w.r.t enforce_https is just detecting a failure for any http:// link, regardless of whether it or its https:// counterpart exists (is accessible). If you do not want html-proofer to detect such failures, and instead just do the check of whether the link as specified exists, just disable this behavior via --no-enforce-https.

Linking here an old issue #314 with some discussions around http:// links having https:// alternative, which is not something html-proofer is meant to check.

RichardLitt commented 1 year ago

Got it! Thank you.

gjtorikian commented 1 year ago

As well, if you'd prefer to keep HTTPS checks on for everything, but off for this one link, you could: