Mobile app version of vmapp.org
Login or Join
Ravi8258870

: How does this link redirect? Following this link in a web browser http://www.esdc.gc.ca/en/cpp/post_retirement/eligibility.page eventually leads to https://www.canada.ca/en/services/benefits/publicpensions/cpp/cpp-post-retirement/eligibilit

@Ravi8258870

Posted in: #301Redirect #Http #Redirects

Following this link in a web browser www.esdc.gc.ca/en/cpp/post_retirement/eligibility.page eventually leads to www.canada.ca/en/services/benefits/publicpensions/cpp/cpp-post-retirement/eligibility.html
However, my broken link checker marks it as a broken link. And sure enough, the response code for the original link is a 404. However I'm trying to make my link checker smarter and to follow any redirections to perhaps discover a working link in the end. My problem however is that I can't seem to figure out how the first redirection is done for the above link.

Looking at it in the Network tab of the Chrome inspector, it's easy to see the path it takes:

1) www.esdc.gc.ca/en/cpp/post_retirement/eligibility.page 2) www.esdc.gc.ca/cgi-bin/op-so/err/404-fra.asp?servertype=apache&p=404;http://www.esdc.gc.ca/en/cpp/post_retirement/eligibility.page 3) www.esdc.gc.ca/cgi-bin/op-so/err/redirect-outbound.asp?status=301%20Moved%20Permanently&redirect_path=/en/cpp/post_retirement/eligibility.page&url=https%3A%2F%2Fwww%2Ecanada%2Eca%2Fen%2Fservices%2Fbenefits%2Fpublicpensions%2Fcpp%2Fcpp%2Dpost%2Dretirement%2Feligibility%2Ehtml 4) www.canada.ca/en/services/benefits/publicpensions/cpp/cpp-post-retirement/eligibility.html

2 and 3 are HTTP 302 and 301 respectively, both with Location headers. Leaving good practices aside, that's fine, at least I can follow those. But what about the first one? I can't figure out what makes it jump from 1 to 2.

There's no response body at all so it can't be a JavaScript window.location. All that remains in my mind is an HTTP Location but I don't see any. What am I missing here?

10.01% popularity Vote Up Vote Down


Login to follow query

More posts by @Ravi8258870

1 Comments

Sorted by latest first Latest Oldest Best

 

@Barnes591

The initial request for www.esdc.gc.ca/en/cpp/post_retirement/eligibility.page returns a page that contains the following...

<script>
window.location.replace("/cgi-bin/op-so/err/404-fra.asp?servertype=apache&p=404;http://www.esdc.gc.ca/en/cpp/post_retirement/eligibility.page");
</script>


... which is how you get from step 1 to step 2. If you disable javascript, you'll get stuck on step 1 and can see the source.

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme