I have followed this guide to getting a nextjs 14 application using SSR running under a sub domain in IIS
https://docs.lextudio.com/blog/running-next-js-web-apps-on-iis-with-httpplatformhandler/
My web.config looks like this:
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<handlers>
<add name="httpPlatformHandler" path="*" verb="*" modules="httpPlatformHandler" resourceType="Unspecified" requireAccess="Script" />
</handlers>
<httpPlatform stdoutLogEnabled="true" stdoutLogFile=".node.log" startupTimeLimit="20" processPath="C:Program Filesnodejsnode.exe" arguments=".node_modulesnextdistbinnext start">
<environmentVariables>
<environmentVariable name="PORT" value="%HTTP_PLATFORM_PORT%" />
<environmentVariable name="NODE_ENV" value="Production" />
<environmentVariable name="NEXT_PUBLIC_BASE_PATH" value="/NextApp" />
</environmentVariables>
</httpPlatform>
</system.webServer>
My app is then accessed at the path /NextApp
This all works, but when switching between routes using the Next Link component the full page is reloading every time rather than just the nested route page being returned. This is resulting in any state managed via React’s Context API to be reset and not persisted between routes.
How can I resolve this? I understand it may be necessary to configure some rewrite rules, but so far Ive not been able to make anything work.