Skip to content
This repository has been archived by the owner on Sep 8, 2023. It is now read-only.

Remove javascript domain redirects #74

Closed
davidstanke opened this issue Nov 20, 2017 · 0 comments
Closed

Remove javascript domain redirects #74

davidstanke opened this issue Nov 20, 2017 · 0 comments
Assignees

Comments

@davidstanke
Copy link
Contributor

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.

OBSOLETE: REMOVE THESE

      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/"));
      }

a) bazel.build.github.io/bazel --> bazel.build : unnecessary; github does this for us
b) bazel.io --> bazel.build : no longer needed; http redirector does this now
c) http --> https : no longer needed; http redirector does this now

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/"));
      }
@davidstanke davidstanke self-assigned this Nov 20, 2017
davidstanke added a commit that referenced this issue Nov 20, 2017
See: #74 -- these js redirects are unnecessary now b/c they are handled by http redirector
davidstanke added a commit to bazelbuild/bazel that referenced this issue Nov 20, 2017
See bazelbuild/bazel-website#74 -- these domain redirects are obsolete.
bazel-io pushed a commit to bazelbuild/bazel that referenced this issue Nov 21, 2017
See bazelbuild/bazel-website#74 -- these domain redirects are obsolete.

Closes #4130.

PiperOrigin-RevId: 176509860
davidstanke added a commit that referenced this issue Dec 1, 2017
davidstanke added a commit that referenced this issue Dec 1, 2017
laurentlb pushed a commit that referenced this issue Sep 9, 2019
See: #74 -- these js redirects are unnecessary now b/c they are handled by http redirector
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant