Uploaded image for project: 'Data Management'
  1. Data Management
  2. DM-5893

LSST the Docs Fastly should redirect /en/latest/ to /

    XMLWordPrintable

    Details

      Description

      Previously we deployed documentation on Read the Docs. By default, Read the Docs would show the master version of documentation on "/en/latest/". Many links with that endpoint may already exist. We should configure Fastly to redirect such paths to "/".

        Attachments

          Activity

          Hide
          jsick Jonathan Sick added a comment -

          Implemented in Fastly config version #14! (previous stable was Version #11).

          Solution was to follow the Fastly docs at https://docs.fastly.com/guides/performance-tuning/generating-http-redirects-at-the-edge

          Steps are

          1. Make a new response called “Redirect from RTD” with Status “301.” Give it a request condition called “URL is /en/latest/“ that applies if req.url ~ "^/en/latest”. Give this condition a priority of 10 so that it applies before all other request conditions (i.e., we want to deal with this specific URL and redirect it first)
          2. Create a response Header called “Location for RTD redirect”. This header sets the Location HTTP header to "https://" req.http.Fastly-Orig-Host regsub(req.url, "/en/latest(.+)$", "\1”). That is, it makes an absolute URL with /en/latest/ stripped out. The response condition is called “Set Location for RTD redirect” and applies if req.url ~ "/en/latest" && resp.status == 301
          Show
          jsick Jonathan Sick added a comment - Implemented in Fastly config version #14! (previous stable was Version #11). Solution was to follow the Fastly docs at https://docs.fastly.com/guides/performance-tuning/generating-http-redirects-at-the-edge Steps are Make a new response called “Redirect from RTD” with Status “301.” Give it a request condition called “URL is /en/latest/“ that applies if req.url ~ "^/en/latest” . Give this condition a priority of 10 so that it applies before all other request conditions (i.e., we want to deal with this specific URL and redirect it first) Create a response Header called “Location for RTD redirect”. This header sets the Location HTTP header to "https://" req.http.Fastly-Orig-Host regsub(req.url, " /en/latest(.+)$", "\1”) . That is, it makes an absolute URL with /en/latest/ stripped out. The response condition is called “Set Location for RTD redirect” and applies if req.url ~ " /en/latest" && resp.status == 301

            People

            Assignee:
            jsick Jonathan Sick
            Reporter:
            jsick Jonathan Sick
            Watchers:
            Jonathan Sick
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:

                Jenkins

                No builds found.