Dev

Why a link health check needs an unknown state

A monitoring script requests a page, cannot find a link, and reports that the link has disappeared. That sounds reasonable until the response turns out to be an access challenge, an incomplete document or a page that builds its links in JavaScript.

Original content from computingforgeeks.com - post 183271

The script has observed a failure to verify the link. It has not necessarily observed a removed link. Treating those as the same event creates noisy reports and sends people after the wrong problem.

When building a small link checker, it helps to separate three questions: what was expected, what the HTTP request actually returned, and what action the evidence supports. This applies to partner references, documentation links and paid placements alike.

Keep expectations separate from observations

Start with a stable record for each link. Store the original source URL, expected destination and any agreed anchor text. If money changed hands, attach the order and terms reference. Keep the payment model separate from the retention promise: a one-time payment does not describe how long the publisher must retain the page.

Do not replace the original destination when the website moves. Preserve it and record the new intended destination separately. Otherwise, a later check can silently change the requirement it was supposed to verify.

A useful observation includes the check time, first response, final response, redirect chain and links found. That lets another person inspect the conclusion without rerunning a request against a page that may already have changed.

A 404 or 410 response supports a different conclusion from a 403 or 429. The first pair can establish that the requested page is unavailable at the time of the check. The second pair means the checker could not inspect it through that request.

A timeout, TLS failure or DNS error also leaves the link unverified. Save the failure category and stop. Disabling certificate checks or repeatedly hammering the server makes the monitor less trustworthy.

Even HTTP 200 needs inspection. Confirm that the response is HTML and check for recognizable access-challenge content before treating it as the publisher’s page. Challenge detection is imperfect, so retain enough response metadata for a person to investigate an important exception.

Use explicit states such as present, missing_in_fetched_html and unverified. That middle state is deliberately narrow. It reports what the parser found, while leaving room for a rendered-browser check when appropriate.

Check the destination as well as the source

A backlink can remain in place while its destination fails. Inspect both sides.

Resolve relative links against the document’s base URL. Compare the resulting destination with the expected URL, and preserve query parameters when they distinguish destinations. Record the actual anchor text and rel attributes rather than reducing everything to a green checkmark.

Then request the destination and retain its redirect chain. A working redirect to a relevant replacement can preserve the visitor’s route. A final 200 response alone is insufficient: a generic error page or unrelated homepage can also return 200. Important exceptions deserve a final-page identity check.

For a migration-specific example, Modern Labyrinth’s URL acceptance worksheet explains how to record expected redirects, query behavior and final-page identity before signing off a release.

Canonical and robots directives provide additional context. A changed canonical, a noindex directive or a changed link attribute is a signal to review; it does not, by itself, establish a contractual breach or a search-ranking effect.

Bound the work a checker can perform

For a manual tool, start with a small selected batch. Set response-size, redirect and timeout limits. Keep ordinary TLS verification enabled. Validate destinations again on redirects, and exclude local, private and credential-bearing URLs.

Those checks reduce accidental access to unintended systems. They do not turn a small script into a hardened service that can safely fetch arbitrary hostile URLs. A public URL-checking service needs a stronger network boundary and its own security review.

Keep notifications and recovery actions outside the initial fetcher. First produce a reviewable result. A monitor should not automatically accuse a publisher, submit a refund request or buy a replacement because one request failed.

Test the decisions, including uncertainty

Use local fixtures for a present link, a readable page without it, a relative destination, an attribute change, a redirect, an access challenge and a network failure. Check that each case produces the intended state. Include a destination failure even when the source link remains present.

These tests establish the checker’s behavior on known inputs. They do not establish what a real publisher currently serves. Keep live observations dated, and keep search-index observations separate from direct requests: either may describe a different point in time.

The useful output is a small evidence record that tells someone what to inspect next. Preserving an honest unknown state is part of making that record reliable.

About the contributor: Modern Labyrinth is a software and web development team.

Keep reading

Install Wazuh SIEM on Ubuntu 26.04 LTS: All-in-One Setup Monitoring Install Wazuh SIEM on Ubuntu 26.04 LTS: All-in-One Setup Upgrade Zabbix 7.0 to 8.0 LTS on Ubuntu 26.04 and Rocky Linux 10 Monitoring Upgrade Zabbix 7.0 to 8.0 LTS on Ubuntu 26.04 and Rocky Linux 10 Install Zabbix 8.0 LTS on Ubuntu 26.04 Monitoring Install Zabbix 8.0 LTS on Ubuntu 26.04 Install and Use VictoriaMetrics time-series database on Ubuntu Databases Install and Use VictoriaMetrics time-series database on Ubuntu TICK Stack vs InfluxDB 3: Do Kapacitor and Chronograf Still Work? Databases TICK Stack vs InfluxDB 3: Do Kapacitor and Chronograf Still Work? Install and Use LuLu free macOS firewall macos Install and Use LuLu free macOS firewall

Leave a Comment

Press ESC to close