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

Report if a link is going to redirect #353

Closed
gjtorikian opened this issue Sep 9, 2016 · 10 comments
Closed

Report if a link is going to redirect #353

gjtorikian opened this issue Sep 9, 2016 · 10 comments

Comments

@gjtorikian
Copy link
Owner

No description provided.

@jamietanna
Copy link

I'd be happy picking this up. Any thoughts on what output format you'd like for this, @gjtorikian?

@gjtorikian
Copy link
Owner Author

I think having it appear as an INFO log statement might be nice. As well, having an option like --report-redirects could also result in printing out the redirects, so that people who want to can also go back and fix redirected links into the right place.

@jamietanna
Copy link

From what it looks like, typhoeus would be handling the actual requests, so would that mean that we'd need to add the functionality to that?

@msh100
Copy link

msh100 commented Aug 5, 2017

It would be nice if this worked with https://github.com/jekyll/jekyll-redirect-from too. It would return a 200 but with a HTML meta redirect.

Maybe this could be more generalised and look for pages which link to pages with a certain string match in them.

@fulldecent
Copy link
Collaborator

I think checking redirect by HTTP code is in scope but anything else is out of scope.

What about javascript redirects? What about HTML pages with a big link, like this one

https://aclsrecertificationonline.com/

@msh100
Copy link

msh100 commented Aug 7, 2017

I am not sure I agree, I test with local files - there's no way of testing HTTP status codes when you don't use HTTP. Maybe I'd agree if HTML proofer depended on HTTP.

Edit: Further to this, the better approach for my use-case maybe to invoke a failure on a link to a page with a regex match.

@fulldecent
Copy link
Collaborator

We currently test broken links with HTTP.

@thbar
Copy link

thbar commented May 26, 2020

Is there a trick to forbid 302 redirections or log them today?

For some context, I'm trying to detect broken links to GitHub wiki pages that do not exist. They result in 302 (which leads to a new page to create the missing page).

# OK
$ curl -I https://github.com/thbar/kiba/wiki/SQL-Bulk-Lookup
HTTP/1.1 200 OK

# I would like to raise in this case!
$ curl -I https://github.com/thbar/kiba/wiki/SQL-Bulk-Lookupx
HTTP/1.1 302 Found

I could restrict Wiki editing I presume, but wondering if this can be achieved today with some configuration maybe?

Thanks!

@gjtorikian
Copy link
Owner Author

HTML-Proofer accepts all Typhoeus config options so you could do something like:

options = { typhoeus: { followlocation: false } }
HTMLProofer.check_directory("./_site", options).run

@gjtorikian
Copy link
Owner Author

Not sure why I was interested in adding this, but doesn't seem to be a whole lot of interest in it. Closing for now, will open if it's an enhancement people crave. It would only appear in the logs.

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

No branches or pull requests

5 participants