Automatic detection of externally rendered pages
Enable automatic detection of externally rendered pages
To enable automatic detection, perform the following:
-
Update your proxy file using the sample below.
Depending on your project structure, this file may be named proxy.ts or middleware.ts.
- In your environment configuration, set the following variable:
SF_PROXY_BY_DEFAULT="true"
-
Restart the Next.js renderer application.
When SF_PROXY_BY_DEFAULT is set to true, the proxy switches to proxy-by-default mode. In this mode, requests are sent to Sitefinity unless the middleware detects that the requested page is externally rendered and should be served through Next.js.
When to use fallback path settings
Automatic detection does not replace all proxy-related configuration.
Use the following settings when you need explicit routing behavior:
- Use
SF_WHITELISTED_PATHS for legacy MVC pages, WebForms pages, or custom paths that must always be proxied to Sitefinity.
- Use
SF_IS_HOME_PAGE_LEGACY="true" when the site home page (/) is still implemented as a legacy page and must be proxied to Sitefinity.
- Use
SF_WHITELISTED_WEBSERVICES for additional Sitefinity web service endpoints that must pass through the proxy.
If your project still depends on explicit frontend path routing, SF_WHITELISTED_NEXTJS_PATHS remains a valid fallback option.
Proxy sample