Sitemap.xml on a Nuxt site

Deployed a nuxt site to the XDN and trying to serve my sitemap, receiving the following error:
None of the specified routes in "default" destination have matched the request (edge receive).

I assumed this would be treated like any other static file, and it works locally. We also tried forcing it in the router:

 .match('/sitemap.xml', ({ serveStatic }) => {

Additionally, on the nuxt example in the docs I see the same behavior:

I modified the example to use @nuxtjs/sitemap with the following config in nuxt.config.js

  modules: [
    sitemap: {
      hostname: '',
      gzip: true,
      exclude: [
      routes: [
          url: '/page/3',
          changefreq: 'daily',
          priority: 1,
          lastmod: '2017-06-30T13:30:00.000Z'

From the nuxt sitemap example docs, and see the same behavior on the XDN:

It’s likely the issue is there was not a sitemap.xml file generated in your build and thus it is trying to serve an asset that doesn’t exist.

The @nuxtjs/sitemap module doesn’t appear to generate a static sitemap unless you run npm run generate which will create the dist/sitemap.xml file based on your Nuxt configuration. After generating, then you can deploy and verify the response is correct.

@tristan.lee it says in the docs it Works with all modes (SSR, SPA, generate). @nuxtjs/sitemap - npm

It should definitely be working for all builds, not just static ones.

Actually, it does seem to not generate a static sitemap in SSR mode. It treats sitemap.xml as a normal Nuxt route. With that in mind, how do I get XDN to allow it to work like any other route?

It looks like you are correct, for SSR it won’t generate the static file. This is why I suggested using generate specifically just for that file.

It also doesn’t appear the Nuxt route is properly handling the SSR route. I will create a ticket for this.

I created an internal ticket for this: XDN-8615

I overlooked a function on the ResponseWriter which is renderWithApp and this can be used to serve sitemap.xml using SSR simply by defining:

.match('/sitemap.xml', ({ renderWithApp }) => {

I was able to verify this on my example app. Let me know if this solves your issue.