Whenever I try to use Experience Editor towards my headless (dotnet) rendering host I get the following error:

Connection to your rendering host failed with a Not Found error. Ensure the POST endpoint at URL http://localhost:5268/jss-render has been enabled.

And this error in my Rendering Host console output:

> [15:06:53 ERR] The JSS_EDITING_SECRET environment variable is missing or invalid.
> [15:06:53 INF] HTTP POST /jss-render responded 400 in 7.7200 ms

I have the following setting in my Sitecore installation:

<setting name="JavaScriptServices.ViewEngine.Http.JssEditingSecret" value="SitecoreJssEditingSuperSecretValue" patch:source="Sitecore.JavaScriptServices.ViewEngine.Http.config"/>

and I have the following in my launchsettings.json:

  "profiles": {
    "My.Project.Rendering": {
      "commandName": "Project",
      "dotnetRunMessages": true,
      "launchBrowser": true,
      "applicationUrl": "https://localhost:7268;http://localhost:5268",
      "environmentVariables": {
        "ASPNETCORE_ENVIRONMENT": "Development",
        "JSS_EDITING_SECRET": "SitecoreJssEditingSuperSecretValue",
        "SITECORE_JSS_EDITING_SECRET": "SitecoreJssEditingSuperSecretValue"

Which should ensure that the environment variable is set, and both Sitecore and my rendering host should be set up to use "SitecoreJssEditingSuperSecretValue" as the key, yet the error still appears in the rendering host and Experience Editor still fails.

This is a standalone 10.2 XP0 installation without Docker.

What am I missing here?

1 Answer 1


It seems that this is a very misleading error message. I decompiled and looked at the code that returns this message and I can't see it every fetching it from the environment variables.

The ExperienceEditorMiddleware injects an IOptions<ExperienceEditorOptions>, which I suppose could be added through an environment variable, but I never got it to work.

Instead I just manually configured the ExperienceEditorOptions in my ConfigureServices() and Experience Editor started working and I never saw the error message again:

public void ConfigureServices(IServiceCollection services)
            .WithExperienceEditor(opt =>
                opt.JssEditingSecret = "YourSecretHere";

You should never hardcode the secret like I've done here, of course. I actually ended up putting it into appsettings.json which is bound to a data model, and I use the information from the data model instead of the hardcoded value.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.