always redirect version-catchall URLs to their latest version #342
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes #316 (the iteration where semver-catchall URLs were getting updated after they were cached the first time)
One of docs.rs's powerful features is the ability to provide semver requirements in lieu of actual version numbers in many places. However, when combined with a CDN that likes to cache content at certain URLs, that can cause problems when not all URLs for a certain crate are cached at the same time. For example, if you load
docs.rs/tokio/0.1/tokio/index.html
, it's not certain whether you'll load theindex.html
from0.1.0
or0.1.19
(the current latest version in that series), since the CDN could have cached the page from an earlier version and hasn't updated the cache since then. (Or perhaps more confusing, it has updated the cache, but only in certain regions, and not everywhere has the right version yet, which happened on a different issue.)This PR aims to solve the problem by never serving a URL where the "version" doesn't match the actual version number of the docs it's serving. Instead it aims to issue redirects to the URL with the exact version information. This way, the URL that actually serves the content is the one that's not expected to change over time.