This project is not covered by Drupal’s security advisory policy.

GraphQL Redirect is a simple module extending contributed GraphQL module. It replaces default route handling so that GraphQL query follows redirects created by Redirect module and returns query result for the destination route. It supports internationalization and chained redirects.

Example: Imagine having content page with alias "/test-page" and a redirect from "/test-page-redirect" to "/test-page". With built-in GraphQL route handling, querying route "/test-page-redirect" would return null, since it does not recognize redirects. With GraphQL Redirect, querying:

{
  route(path:"/test-page-redirect") {
    ... on EntityCanonicalUrl {
      pathAlias
      entity {
        entityId
        entityLabel
      }
    }
  }
}

returns:

{
  "data": {
    "route": {
      "pathAlias": "/test-page",
      "entity": {
        "entityId": "1",
        "entityLabel": "Test page"
      }
    }
  }
}

If pathAlias is different than path provided in the query parameters, client knows there was a redirect and needs to change URL to the destination one.

Important: Until #2962966: findByRedirect doesn't handle cacheable dependencies correctly is resolved, GraphQL Redirect will require this patch to work correctly.

Project information

Releases