CDN that provides Redirects?
-
26-05-2021 - |
题
We need a CDN (like Rackspace Files or AWS) that allows us to set up 301 redirects to old files.
E.g. if we decide to delete http://cdn.example.com/mportant-case-study.pdf
, we'll want to redirect that old asset to our case studies page, http://www.example.com/case-studies/
. Or maybe, we noticed there was a typo in the original file, we already shared it in an email and via Twitter, then we would redirect it to http://cdn.example.com/important-case-study.pdf
(notice the "i" isn't forgotten this time).
So the question, in case it wasn't already clear: What CDNs offer this?
解决方案
Do you want the CDN to get the redirects from your origin servers or not?
Akamai can cache redirects from your origin. Alternately you can modify your Akamai configuration to generate the redirects at the edge.
If you have a lot of redirects it's probably easier to generate them from your origin, otherwise you end up modifying the Akamai config every time you need to add/change/delete redirects. This takes time.
Here's an example where the redirect is generated at the origin, but cached by the edge server (I've inserted a header called "FakeDate" from the origin so I can prove the redirect is cached:
http://cdn1.lapthorn.com/testing/redirect-cached.php
Or here's a redirect generated by the edge server which will never come back to the origin:
http://cdn1.lapthorn.com/microsoft-test-redirect
You can go direct to the origin at origin-www.lapthorn.com to see what headers I'm sending.