For a SvelteKit app hosted on Windows Server 2019 IIS v10.0.17763.1 using iisnode, I'm struggling to get the sitemap.xml file, which is in the root folder, to be publicly visible. This feels like an IIS web.config issue, but I'm not sure if the way I'm hosting via iisnode is complicating things since the root of the site is technically not visible directly hence https....mysite.com/sitemap.xml returns a 404 - File or directory not found error.
See below web.config file with SiteMap rule.
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<iisnode nodeProcessCommandLine=""C:\Program Files\nodejs\node.exe"" watchedFiles="web.config;*.js;*.cjs" />
<handlers>
<!-- Indicates that the server.js file is a node.js site to be handled by the iisnode module -->
<add name="iisnode" path="server.cjs" verb="*" modules="iisnode" />
</handlers>
<rewrite>
<rules>
<!-- All other URLs are mapped to the node.js site entry point -->
<rule name="node">
<match url=".*" />
<action type="Rewrite" url="server.cjs" />
</rule>
<rule name="SiteMap" patternSyntax="Wildcard" stopProcessing="true">
<match url="sitemap.xml" />
<action type="Rewrite" url="/sitemap.xml" appendQueryString="false" />
</rule>
<rule name="HTTPS Redirect" enabled="true" stopProcessing="true">
<match url="(.*)" />
<conditions>
<add input="{HTTPS}" pattern="^OFF$" />
</conditions>
<action type="Redirect" url="https://{HTTP_HOST}{REQUEST_URI}" appendQueryString="false" />
</rule>
</rules>
<outboundRules>
<rule name="back">
<match serverVariable="RESPONSE_Location" pattern="(.*)/server.cjs" />
<action type="Rewrite" value="{R:1}" />
</rule>
</outboundRules>
</rewrite>
<httpProtocol>
<customHeaders>
<!-- security headers here -->
</customHeaders>
</httpProtocol>
</system.webServer>
</configuration>
server.cjs
process.env.SOCKET_PATH = process.env.PORT;
delete process.env.PORT
import('./index.js')
What am I doing wrong?