3

We are trying to configure URL redirect rules using redirect map, but it is not working on edge. when we are trying to fetch rendering data from edge it is always giving us 200 Response code with either data in layout or with null data in layout. Please let us know if we need to configure something or how it works.

1
  • Edge has some caching issues, we also faced similar kind of caching issues, It took around 30 mins to show the proper results. You can remove the cache from admin api, Though i haven't tried that but may be a workaround for you.
    – Gautam
    May 26, 2023 at 14:05

3 Answers 3

0

Please review the caching settings to ensure they are configured correctly on the edge server. Incorrect caching settings may cause problems with retrieving data or with the URL redirect rules.

7
  • Any change in content is coming so how can it be caching issue. Also I wanted to know how Edge api responds in case of redirect configured for a URL. As httprequest pipeline is not working with Edge api request and in SXA redirect was handled using Http Request pipeline only, not sure how it will work in Edge api. We have configured our redirects with below references. doc.sitecore.com/xmc/en/users/xm-cloud/map-a-url-redirect.html Apr 3, 2023 at 5:17
  • Use redirect module it will resolve your issue sitecorescientist.com/2018/10/17/redirect-module-for-sitecore-9 Apr 3, 2023 at 5:25
  • Do you know if this module is supported for Sitecore XM cloud Apr 3, 2023 at 13:21
  • Yes it is supported Apr 3, 2023 at 16:19
  • Hi Biswajit, I went throught the code of Redirect Module and in that HttpRequestPipeline is used to redirect while when I am adding a HttpRequestPipeline in XMCloud and requesting a data for page it is not hitting that pipeline. So how can that support XM cloud, do you know anyone who has used it so that I can connect with them and understand how can it be used Apr 4, 2023 at 6:00
0

You need to be aware of the caching issue on the Edge, by default the edge has 4:00 hours caching time, if you want to get redirect map immidiately to work, you need to do following:

  • publish the redirect map item
  • publish the site item: (template:/sitecore/templates/Project/rosengroup/Headless Site ). this step will invalidate the caching on Edge.

You can check the redirects by running this query:

query RedirectsQuery($siteName: String!) {
  site {
    siteInfo(site: $siteName) {
      redirects {
        pattern
        target
        redirectType
        isQueryStringPreserved
        locale
      }
    }
  }
}

I had a few discussion about redirect and redirect maps with sitecore support. This behaviour is by design and after the changes on redirect map you need to publish the Site item.

If the grapql query returns the correct result, then you need to check your frontend. If you are using the next js, you need to check the priority of the redirect middleware, if it has a lower priority, it can cause the redirects to stop working.

0

SXA headless supports defining the redirects under Settings. The redirects are handled inside the Next.js middleware. I would recommend using the redirects map https://doc.sitecore.com/xmc/en/users/xm-cloud/map-a-url-redirect.html. You will notice that the documentation would recommend using ^ and $ for regex patterns. You would not need these symbols for regex. Hope this helps you.

1
  • "You would not need these symbols for regex" - Can you clarify? Is this because the nextjs middleware code appends these manually? Jan 2 at 17:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.