I'm utilizing Sitecore Headless mode with React in an SSR app, along with a Sitecore 10.3 JSS SXA setup that includes Sitemap.xml and robots.txt enabled and published.

I'm encountering an issue where I cannot access the sitemap.xml and robots.txt in the JSS app domain. For instance, www.JSSappService.com/sitemap.xml returns a 404 error. However, the Sitecore CD and Sitecore CM app service URLs successfully load the sitemap and robots.txt files.

  • Are you using Next.js or just react?
    – Richard Seal
    Commented Mar 22 at 17:35
  • Just React with SSR app to render it Commented Mar 22 at 17:36

1 Answer 1


In your SSR app, there is a file named config.ts inside the src folder. There, you can find this code.

pathRewriteExcludeRoutes: A list of absolute paths
   * that are NOT app routes and should not attempt to render a route
   * using SSR. These route prefixes are directly proxied to the apiHost,
   * allowing the proxy to also proxy GraphQL requests, REST requests, etc.
   * Local static assets, Sitecore API paths, Sitecore asset paths, etc should be listed here.
   * URLs will be encoded, so e.g. for a space use '%20' in the exclude.
   * Need to perform logic instead of a flat list? Remove this and use
   * pathRewriteExcludePredicate function instead: (url) => boolean;
  pathRewriteExcludeRoutes: [
  ].concat((process.env.SITECORE_PATH_REWRITE_EXCLUDE_ROUTES || '').split('|')),

Just add /sitemap.xml and /robots.txt in pathRewriteExcludeRoutes to the above code to rewrite the URLs.

Or put these URLs in the SITECORE_PATH_REWRITE_EXCLUDE_ROUTES= setting of the .env file.

  • To be clear - Headless SXA features will require customization in the web application if you are using anything else other than Next.js. The Next.js starter kit includes these customizations by default. If you are starting a new project and want to use React, just use Next.js - your life will be better.
    – Richard Seal
    Commented Mar 22 at 19:30

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.