Kentico Preview Mode Not working

KSA&D Development asked on February 24, 2021 05:00

Upon doing a fresh install of the kentico 13 dancing goat theme, when you go to the page tab on the homepage or preview button. Two things either happen. 1. If your presentation URL is set to localhost you get this message: "This page does not work properly as your browser may be blocking 3rd party cookies and/or the system may be incorrectly configured for a multi-domain environment." or two if you change your presentation URL to the URL of your site then you just get a blank page for the preview mode.

These are new servers and fresh installs of kentico 13 that are getting this issue. Any ideas?

Correct Answer

Yuriy Sountsov answered on February 24, 2021 20:31

Hello everybody. Setting the sites to HTTPS and restarting the servers resolved the issue. I am waiting for confirmation from KSA&D, however with modern browser security standards and X13 HTTPS is a must.

2 votesVote for this answer Unmark Correct answer

Recent Answers


David te Kloese answered on February 24, 2021 09:32

Are you running both over https?

is site and preview different domain or subdomain?

Can you see if you have the following in web.config appsettings: <add key="CMSAdminCookiesSameSiteNone" value="true" />

see docs.xperience.io/...ConfiguringcookieSameSitemode-Multi-domainenvironment

0 votesVote for this answer Mark as a Correct answer

KSA&D Development answered on February 24, 2021 16:06 (last edited on February 24, 2021 16:06)

I added that code to the webconfig but not change. No both are the same domain. I have installed kentico 13 on two different servers and on one instance made no modifications to the dancing goat installation and still same issue. I have also checked the salt key on both the web.conig and appsettings.json and they match as well. From two different servers it makes me think I'm missing something in my server set up but I'm not sure what it would be.

0 votesVote for this answer Mark as a Correct answer

David te Kloese answered on February 24, 2021 16:29

Are you running over https?

I have a local environment that just pops up with the exact same issue... on Chrome. I think it's because it doesn't trust the SSL certificate, in Firefox I could easily trust the certificate on both admin and site and it seemed to work.

Chrome seems to have a bit more issues... Could you try running both over http? If that works it must be with the cert and this might help: https://www.pico.net/kb/how-do-you-get-chrome-to-accept-a-self-signed-certificate

but haven't tried it as for me if this environment works in Firefox is fine enough :)

0 votesVote for this answer Mark as a Correct answer

David te Kloese answered on February 24, 2021 16:46

Hmm... got it now also working in chrome when I first accepted the risk on the site before going into the admin.

0 votesVote for this answer Mark as a Correct answer

KSA&D Development answered on February 24, 2021 16:46

I have tried locally, I have tried with no https, I have tried running through visual studio same issue. I am getting these errors in the event log.

Message: JWT token validation has failed. Make sure you have set the same 'CMSHashStringSalt' app setting for all application instances.

Exception type: System.Exception

I have checked the salt key on both the web.conig and appsettings.json and they match.

0 votesVote for this answer Mark as a Correct answer

David te Kloese answered on February 24, 2021 16:51

Could be related to the macros

Could you resign all macros in the System module: resign macros

0 votesVote for this answer Mark as a Correct answer

KSA&D Development answered on February 24, 2021 17:54

Tried that as well still no effect. If this is happening though on a fresh install wouldn't this mean more of something missing in the server setup?

0 votesVote for this answer Mark as a Correct answer

KSA&D Development answered on February 24, 2021 18:32

So I saw that .net core runtime was not installed on the server. I installed that as well as java and now locally, the preview is working. When I look at the domain its still not. And I'm still getting this error.

Connection ID "12970367031516856326", Request ID "80000007-0018-b400-b63f-84710c7967bb": An unhandled exception was thrown by the application. Message: Try reloading the administration interface. The user was not found in the JWT token, nor in the current virtual context URL.

Exception type: CMS.Helpers.InvalidVirtualContextException Stack trace: at Kentico.Content.Web.Mvc.VirtualContextPrincipalRetriever.GetPrincipal(String jwtToken) at Kentico.Content.Web.Mvc.VirtualContextRequestPrincipalRetriever.Retrieve(HttpRequest request) at Kentico.Web.Mvc.AuthenticationHandler.HandleAuthenticateAsync() at Microsoft.AspNetCore.Authentication.AuthenticationHandler1.AuthenticateAsync() at Microsoft.AspNetCore.Authentication.AuthenticationService.AuthenticateAsync(HttpContext context, String scheme) at Microsoft.AspNetCore.Authentication.AuthenticationMiddleware.Invoke(HttpContext context) at Microsoft.AspNetCore.Session.SessionMiddleware.Invoke(HttpContext context) at Microsoft.AspNetCore.Session.SessionMiddleware.Invoke(HttpContext context) at Kentico.Content.Web.Mvc.ContentOutputMiddleware.InvokeAsync(HttpContext context) at Kentico.Web.Mvc.KenticoRequestLocalizationMiddleware.InvokeAsync(HttpContext context) at Kentico.Content.Web.Mvc.PageRedirectionContextMiddleware.InvokeAsync(HttpContext context) at Kentico.Web.Mvc.KenticoRequestEventsMiddleware.InvokeAsync(HttpContext context) at Microsoft.AspNetCore.Diagnostics.StatusCodePagesMiddleware.Invoke(HttpContext context) at Kentico.Web.Mvc.KenticoErrorHandlingMiddleware.InvokeAsync(HttpContext context, ILogger1 logger) at Strahman.Infrastructure.SmartSearchIndexRebuildMiddleware.InvokeAsync(HttpContext context) in C:\inetpub\wwwroot\strahman-staging\DancingGoatCore\Infrastructure\SmartSearchIndexRebuildMiddleware.cs:line 79 at Microsoft.AspNetCore.Server.IIS.Core.IISHttpContextOfT`1.ProcessRequestAsync()

0 votesVote for this answer Mark as a Correct answer

KSA&D Development answered on February 24, 2021 18:36

I also forgot to mention even with the preview working locally, I still get this error message too.

"This page does not work properly as your browser may be blocking 3rd party cookies and/or the system may be incorrectly configured for a multi-domain environment.See our documentation for more information."

0 votesVote for this answer Mark as a Correct answer

KSA&D Development answered on February 24, 2021 20:06

I got passed the issues locally, preview and and page view in the admin area now loads with no errors in the event log.

When using the domain outside of the server I still am getting these two things:

This page does not work properly as your browser may be blocking 3rd party cookies and/or the system may be incorrectly configured for a multi-domain environment. See our documentation for more information.

and also Connection ID "17582053054239211529", Request ID "8000000a-0019-f400-b63f-84710c7967bb": An unhandled exception was thrown by the application. Message: Try reloading the administration interface. The user was not found in the JWT token, nor in the current virtual context URL.

Exception type: CMS.Helpers.InvalidVirtualContextException Stack trace: at Kentico.Content.Web.Mvc.VirtualContextPrincipalRetriever.GetPrincipal(String jwtToken) at Kentico.Content.Web.Mvc.VirtualContextRequestPrincipalRetriever.Retrieve(HttpRequest request) at Kentico.Web.Mvc.AuthenticationHandler.HandleAuthenticateAsync() at Microsoft.AspNetCore.Authentication.AuthenticationHandler1.AuthenticateAsync() at Microsoft.AspNetCore.Authentication.AuthenticationService.AuthenticateAsync(HttpContext context, String scheme) at Microsoft.AspNetCore.Authentication.AuthenticationMiddleware.Invoke(HttpContext context) at Microsoft.AspNetCore.Session.SessionMiddleware.Invoke(HttpContext context) at Microsoft.AspNetCore.Session.SessionMiddleware.Invoke(HttpContext context) at Kentico.Content.Web.Mvc.ContentOutputMiddleware.InvokeAsync(HttpContext context) at Kentico.Web.Mvc.KenticoRequestLocalizationMiddleware.InvokeAsync(HttpContext context) at Kentico.Content.Web.Mvc.PageRedirectionContextMiddleware.InvokeAsync(HttpContext context) at Kentico.Web.Mvc.KenticoRequestEventsMiddleware.InvokeAsync(HttpContext context) at Microsoft.AspNetCore.Diagnostics.StatusCodePagesMiddleware.Invoke(HttpContext context) at Kentico.Web.Mvc.KenticoErrorHandlingMiddleware.InvokeAsync(HttpContext context, ILogger1 logger) at Strahman.Infrastructure.SmartSearchIndexRebuildMiddleware.InvokeAsync(HttpContext context) in C:\inetpub\wwwroot\strahman-staging\DancingGoatCore\Infrastructure\SmartSearchIndexRebuildMiddleware.cs:line 79 at Microsoft.AspNetCore.Server.IIS.Core.IISHttpContextOfT`1.ProcessRequestAsync()

0 votesVote for this answer Mark as a Correct answer

KSA&D Development answered on February 24, 2021 20:41

There was also an issue with cloudflare blocking certain parts of kentico. I added an exception to this and it seems to be working now. At least for this install. There is a different issue with the other kentico install I'm working on but for the time being I all close this out.

1 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.