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.
3 Answers
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.
-
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 at 5:17
-
Use redirect module it will resolve your issue sitecorescientist.com/2018/10/17/redirect-module-for-sitecore-9 Apr 3 at 5:25
-
-
-
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 at 6:00
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.
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.