This example demonstrates how to configure your app for production to work exclusively with front-end pages. The middleware should be simplified by removing any unnecessary logic, particularly any logic related to backend pages.
Removing this disables the access to the instance's backend and should be done only to an environment that is meant to be public facing and needs its backend access restricted - like production for example. The idea here is that this approach allows for cleaner and faster processing of requests on the frontend and disables interactions with the backend on that instance. Content and widgets implementations should be handled in that environment via CI and CD and utilizing Sitefinity SiteSync.
PREREQUISITES: You must set up a Sitefinity renderer application and connect it to your Sitefinity CMS application. For more information, see Install Sitefinity in Next.js mode.
To remove the backend middleware check from the middleware.ts file, remove the section below:
middleware.ts
const resultBackend = await middlewareBackend(request); if (resultBackend instanceof NextResponse || resultBackend instanceof Response) { return resultBackend; }
This is how the middleware.ts file looks like without the backend check:
This sample is available in Sitefinity’s GitHub repository. You can run and play with it. To do this, perform the following:
.env.development
PROXY SETTINGS
SF_CMS_URL
SF_LOCAL_VALIDATION_KEY=
npm run dev
Increase your Sitefinity skills by signing up for our free trainings. Get Sitefinity-certified at Progress Education Community to boost your credentials.
This free lesson teaches administrators, marketers, and other business professionals how to use the Integration hub service to create automated workflows between Sitefinity and other business systems.
This free lesson teaches administrators the basics about protecting yor Sitefinity instance and its sites from external threats. Configure HTTPS, SSL, allow lists for trusted sites, and cookie security, among others.
The free on-demand video course teaches developers how to use Sitefinity .NET Core and leverage its decoupled architecture and new way of coding against the platform.
To submit feedback, please update your cookie settings and allow the usage of Functional cookies.
Your feedback about this content is important