There are several js redirects in the bazel.build source (and docs.bazel.build). Port these to the "http redirector" service; they will be redirected via cacheable response headers.
var bad_url = new RegExp("^https?://(bazelbuild.github.io/bazel|(www\.)?bazel.io)/");
if (bad_url.test(current_url)) {
window.location.replace(current_url.replace(bad_url, "https://bazel.build/"));
}
var http_url = new RegExp("^http://(www\.)?bazel.build/");
if (http_url.test(current_url)) {
window.location.replace(current_url.replace(http_url, "https://bazel.build/"));
}
DO NOTHING: (these are necessary if the user starts from https (b/c those requests bypass the http-->https redirector; we may want to change routing so that everything routes through a global dispatcher, but that impacts a lot of things)
// Do a shortcut so that be.bazel.build redirect to the build encyclopedia
var be_url = new RegExp("^https?://be(\.bazel.build)?/?");
if (be_url.test(current_url)) {
window.location.replace(current_url.replace(be_url, "https://docs.bazel.build/be/overview.html"));
}
var be_url = new RegExp("^https?://be(\.bazel.build)?/([a-zA-Z0-9_-]+)([/#](.*))?");
if (be_url.test(current_url)) {
window.location.replace(current_url.replace(be_url, "https://docs.bazel.build/be/$2.html#$4"));
}
// And a short to code reviews
var cr_url = new RegExp("^https?://cr(\.bazel.build)?/([0-9]+)")
if (cr_url.test(current_url)) {
window.location.replace(current_url.replace(cr_url, "https://bazel-review.googlesource.com/c/$2"));
}
// Code review dashboard
var cr_url = new RegExp("^https?://cr(\.bazel.build)?/?")
if (cr_url.test(current_url)) {
window.location.replace(current_url.replace(cr_url, "https://bazel-review.googlesource.com/"));
}