Sitecore / jss

Software development kit for JavaScript developers building web applications with Sitecore Experience Platform
https://jss.sitecore.com
Apache License 2.0
260 stars 273 forks source link

Sitecore NextJS JSS implementation: Redundant call to CD server on when rendering host receive HEAD request #1606

Open mychien1995 opened 1 year ago

mychien1995 commented 1 year ago

Describe the Bug

Hi Team.

We have a Sitecore NextJS JSS + Sitecore XM Solution hosted on Azure App Service.

We recently noticed this behaviour that when our Rendering Host (NextJS) receive a HEAD request (we noticed this since our setup enable Azure Front Door Health Probe), it will still make a GraphQL Request to Sitecore CD Server.

The reason is that in RedirectsPlugin, on every requests received, Rendering Host will still call CD Server to get the Redirect map via the RedirectQuery

This caused unecessary load to the CD server, since the RedirectQuery will trigger Sitecore.XA.JSS.Foundation.Redirects.EdgeSchema.Processors.GetRedirectDataProcessor. This will then trigger a call to item.Axes.GetDescendants, which is a very expensive operation.

Just wondering if anyone else have the same issue as we did, and does Sitecore team have a plan to fix this

To Reproduce

Setup a NextJS JSS + Sitecore XM implementation. Make a HEAD request via postman to the Rendering Host, you can see that it will make a GraphQL request to Sitecore CD server

Expected Behavior

The HEAD request should return a 200 response without triggering the CD server

Possible Fix

No response

Provide environment information

illiakovalenko commented 1 year ago

@mychien1995 Thanks for the detailed information. We have a ticket in our internal backlog and will work on this issue

stale[bot] commented 1 month ago

This has been automatically marked as stale because it has not had recent activity. It will be closed if there is no further activity within 30 days. You may add comments or the 'keep' label to prevent it from closing. Thank you for your contributions.