---
updatedAt: 2026-07-31T09:30:10.000Z
agentTools:
  siteIndex: https://documentation.bloomreach.com/llms.txt
  projectIndex: https://documentation.bloomreach.com/content/llms.txt
---

# SPA integration troubleshooting

This page provides information about common problems that you may run into while integrating Single-Page Applications (SPAs) with Bloomreach Content. Each section consists of a problem explanation, potential reasons causing the problem, and the solution that may help to solve the problem.

We'll continually update this page as we receive more feedback.

## Channel preview in the Experience manager works intermittently in a clustered environment

#### Reason

The most likely cause for this issue is the session affinity between subsequent calls to CMS cluster nodes. The session affinity relies on a server-id query parameter being passed from Bloomreach Content during the redirect to the SPA. The SPA SDK will retrieve the received parameter and pass it to subsequent requests as a `Server-id` header. Bloomreach Content will pick this header and forward the incoming request to the appropriate cluster node.

If the SPA omits the received `server-id` parameter, the SPA SDK will not add a `Server-id` header in the outbound request to the Delivery API and the request will be dispatched in a round-robin fashion. As a result:

* Calls that hit the cluster node aware of the user's session will succeed with a status 200 and the SPA loading fine in the Experience manager.
* Calls that hit a cluster node that doesn't hold the user's session will fail with a status 401 or 500, the SPA will fail to get a response from the Delivery API. 

#### Solution

Always include the full requested path with all its parameters in the property `request.path` of the configuration object that gets passed to the SDK.

## "Mixed content" issues and/or warnings in the Experience manager

Your SPA channel in not displayed in the *Experience manager* and/or your browser is displaying "mixed content" warnings when viewing an SPA channel in the *Experience manager*. Your Bloomreach Content environment uses HTTPS but your SPA uses HTTP.

#### Reason

Modern browsers typically block the display of a page or display warning messages if secure content (HTTPS) is mixed with insecure content (HTTP).

This can occur in your development environment when, for example, loading an SPA channel in the Experience manager while Bloomreach Content uses HTTPS and the SPA uses HTTP.

#### Solution

To avoid mixed content issues while developing your SPA, make sure your SPA uses HTTPS.

HTTPS can be enabled in most frontend frameworks through a single configuration variable, see below for some popular frameworks:

* **React**\
  Please use the `HTTPS=true` environment variable. See [Using HTTPS in development](https://create-react-app.dev/docs/using-https-in-development/) for details.
* **Angular**\
  Please use the `--ssl` flag. See [ng serve](https://angular.io/cli/serve) for details.
* **Vue CLI**\
  Please use the `--https` flag. See [vue-cli-service serve](https://cli.vuejs.org/guide/cli-service.html#vue-cli-service-serve) for details.

Although it is also possible to enable mixed content in most browsers, this workaround is not recommended.

If, after associating a **local** SPA using HTTPS with a development project, the Experience manager channel preview still doesn't load or shows an error, you may need to open the SPA in a separate browser tab and explicitly ignore the warning that the connection is not private and may be unsafe. Since you are in full control of the application, it is safe to ignore the warning.

> ❗️ Important
>
> Production instances should always use HTTPS!

## Previous versions of a page are not loading in the channel preview when selected in the page's version history in the Experience manager.

#### Reason

When selecting a specific version from a page's version history in the Experience manager, a version identifier is passed to the frontend application in a request parameter called `br_version_uuid`. The frontend application must pass the `br_version_uuid` request parameter on to the [Delivery API](https://documentation.bloomreach.com/content/reference/delivery-api)'s [Pages](https://documentation.bloomreach.com/content/reference/pages-endpoint) endpoint so that the correct version of the page is returned. The [SPA SDK](https://documentation.bloomreach.com/content/docs/bloomreach-spa-sdk) implements this out of the box.

If you experience this issue, most likely you are using a custom frontend integration (i.e. not using the SPA SDK) and you are not passing on the `br_version_uuid` request parameter to the Delivery API. In absence of the version identifier, the Delivery API returns the latest version of the page.

The easiest way to confirm this is the case is by monitoring requests to the frontend application and to the Delivery API while selecting page versions in the Experience manager.

#### Solution

In your custom frontend integration, always check requests for the presence of the request parameter `br_version_uuid` and, if present, pass it on in the subsequent request to the Delivery API's Pages endpoint.

## My Web Application Firewall (WAF) blocks requests to the channel preview in the Experience manager because they trigger the Owasp-crs-v030301-id931110-rfi (remote file inclusion) rule.

#### Reason

The remote file inclusion (RFI) security rule is triggered by the preview iframe of the *Experience manager* loading the SPA with an `endpoint` query parameter containing a full URI, as in the following example:

`https://brx-reference-spa-latest.netlify.app/?token=[...]&server-id=[...]&endpoint=https://mycontent.bloomreach.io/delivery/site/v1/channels/mychannel/pages`

Because the value of the parameter is a fully qualified URL, it is considered a remote file inclusion (RFI) vulnerability.

The `endpoint` query parameter is required for Bloomreach-hosted multi-tenant SPAs that are used as default frontend for newly created channels. A new channel's `remoteHostProtection` property is set to `false` by default. When opening a channel with `remoteHostProtection` set to `false` in the *Experience manager*, the `endpoint` query parameter is added to the SPA URL. The SPA SDK will use the URL specified in the 'endpoint' query parameter *only* if the SPA does not have the endpoint set through an environment variable.

Typically the `endpoint` query parameter becomes redundant once a customer deploys their own SPA that uses an environment variable to specify the endpoint.

#### Solution

The solution is to deploy your own SPA application, specifying the endpoint in an environment variable, and to enable `remoteHostProtection` for each of your channels using the Site Management API's [channel endpoint](https://documentation.bloomreach.com/content/reference/updatechannel).

If you don't have your own SPA yet, you can start with cloning the [Reference SPA github project](https://github.com/bloomreach/bloomreach-reference-spa). Make sure to set `NEXT_PUBLIC_BRXM_ENDPOINT` in `.env` to the appropriate [Delivery API](https://documentation.bloomreach.com/content/reference/delivery-api) endpoint for your environment and channel as explained in the [README](https://github.com/bloomreach/bloomreach-reference-spa/blob/main/README.md).

Use the [Site development app](https://documentation.bloomreach.com/content/reference/site-management-api#site-development-app) or the Site Management API's [channels endpoint](https://documentation.bloomreach.com/content/reference/updatechannel) directly to set the `remoteHostProtection` property for your channel(s) to `true`.

## The Experience manager shows the live channel instead of the channel preview or does not update the preview when editing a component

#### Reason

The most likely cause is the `token` header missing from Delivery API requests sent by the SPA.

For the Experience manager to render the channel preview correctly, Delivery API requests from the SPA must include the `token` and `server-id` headers which are stored in the client configuration object.

The SDK handles this transparently by default but in case of SPA implementations that use the SDK selectively or in a non-standard way, developers may need to take care of the headers explicitly.

#### Solution

Make sure your SPA always includes the `token` and `server-id` headers in requests to the Delivery API.

If you are using the SPA SDK selectively on certain pages, you will need to persist the preview-related data when navigating between pages that have and those that don't have a SDK instance. The easiest way to achieve this result is to use cookie storage.

The following code snippets show example implementations of building the configuration object for the respective initialization or data functions, including:

* Reading preview data from the query string and saving it to cookies for restoring it if it isn't available in the query string.
* Extending configuration object for the `initialize` function with preview data (`authorizationToken` and `serverId`).
* Managing cookies using any standard cookie library for your framework.

```typescript Angular (TS)
import { REQUEST, RESPONSE } from '@nguniversal/express-engine/tokens';
import { Request, Response } from 'express';
import cookie from 'cookie';

export class IndexComponent implements OnInit {

...

  constructor(
    router: Router,
    route: ActivatedRoute,
    @Inject(ENDPOINT) endpoint?: string,
    @Inject(REQUEST) @Optional() request?: Request,
    @Inject(RESPONSE) @Optional() response?: Response
  ) {

    const PREVIEW_TOKEN_KEY = 'token';
    const PREVIEW_SERVER_ID_KEY = 'server-id';
    // Read a token and server id from the query params
    const queryToken = route.snapshot.queryParams[PREVIEW_TOKEN_KEY];
    const queryServerId = route.snapshot.queryParams[PREVIEW_SERVER_ID_KEY];

    const cookies = request
      ? cookie.parse(request.cookies ?? request.headers.cookie)
      : cookie.parse(document.cookie);

    // Make priority to values from query string because in cookies they might be outdated.
    const authorizationToken = queryToken ?? cookies[PREVIEW_TOKEN_KEY];
    const serverId = queryServerId ?? cookies[PREVIEW_SERVER_ID_KEY];

    // Save the values from the query string to have ability to restore them when switch back from legacy page to the SPA-SDK rendered page.
    if (response && request) {
      if (queryToken) response.cookie(PREVIEW_TOKEN_KEY, queryToken);
      if (queryServerId) response.cookie(PREVIEW_SERVER_ID_KEY, queryServerId);
    } else {
      if (queryToken) document.cookie = cookie.serialize(PREVIEW_TOKEN_KEY, queryToken);
      if (queryServerId) document.cookie = cookie.serialize(PREVIEW_SERVER_ID_KEY, queryServerId);
    }

    this.configuration = {
      endpoint,
      request,
      endpointQueryParameter: 'endpoint',
      path: router.url,
      // Provide authorization token and server id if they exist to the SPA-SDK initialization method.
      ...(authorizationToken ? { authorizationToken } : {}),
      ...(serverId ? { serverId } : {}),
    } as IndexComponent['configuration'];

    ...
  }
}
```
```typescript Next (TS)
import { setCookies, getCookies } from 'cookies-next';

export const getServerSideProps: GetServerSideProps = async ({
  req: request,
  res: response,
  resolvedUrl: path,
  query, // An object representing the query string
}) => {
  relevance(request, response);

  const PREVIEW_TOKEN_KEY = 'token';
  const PREVIEW_SERVER_ID_KEY = 'server-id';
  // Read a token and server id from the query string
  const queryToken = query[PREVIEW_TOKEN_KEY] as string;
  const queryServerId = query[PREVIEW_SERVER_ID_KEY] as string;

  const cookies = getCookies({ req: request, res: response });

  // Make priority to values from query string because in cookies they might be outdated.
  const authorizationToken = queryToken ?? cookies[PREVIEW_TOKEN_KEY];
  const serverId = queryServerId ?? cookies[PREVIEW_SERVER_ID_KEY];

  // Save the values from the query string to have ability to restore them when switch back from legacy page to the SPA-SDK rendered page.
  if (queryToken) setCookies(PREVIEW_TOKEN_KEY, queryToken, { req: request, res: response });
  if (queryServerId) setCookies(PREVIEW_SERVER_ID_KEY, queryServerId, { req: request, res: response });

  const configuration = {
    path,
    endpoint: process.env.BRXM_ENDPOINT ?? null,
    endpointQueryParameter: 'endpoint',
    // Provide authorization token and server id if they exist to the SPA-SDK initialization method.
    ...(authorizationToken ? { authorizationToken } : {}),
    ...(serverId ? { serverId } : {}),
  };
  const page = await initialize({ ...configuration, request, httpClient: axios });

  return { props: { configuration, page: page.toJSON() } };
};
```
```javascript Nuxt (JS)
@Component({
  async asyncData(context) {
    const PREVIEW_TOKEN_KEY = 'token';
    const PREVIEW_SERVER_ID_KEY = 'server-id';
    // Read a token and server id from the query string
    const queryToken = context.query[PREVIEW_TOKEN_KEY];
    const queryServerId = context.query[PREVIEW_SERVER_ID_KEY];

    // Make priority to values from query string because in cookies they might be outdated.
    const authorizationToken = queryToken ?? context.app.$cookies.get(PREVIEW_TOKEN_KEY);
    const serverId = queryServerId ?? context.app.$cookies.get(PREVIEW_SERVER_ID_KEY);

    // Save the values from the query string to have ability to restore them when switch back from legacy page to the SPA-SDK rendered page.
    if (queryToken) context.app.$cookies.set(PREVIEW_TOKEN_KEY, queryToken);
    if (queryServerId) context.app.$cookies.set(PREVIEW_SERVER_ID_KEY, queryServerId);

    const configuration = {
      baseUrl: process.env.BASE_URL !== '/' ? process.env.BASE_URL : '',
      endpoint: process.env.VUE_APP_BRXM_ENDPOINT,
      endpointQueryParameter: 'endpoint',
      path: context.route.fullPath,
      visitor: context.nuxtState?.visitor,
      // Provide authorization token and server id if they exist to the SPA-SDK initialization method.
      ...(authorizationToken ? { authorizationToken } : {}),
      ...(serverId ? { serverId } : {}),
    };
  }
})
export default class App extends Vue {
  ...
}
```
```typescript React (TS)
import cookie from 'cookie';

export default function App({ location }: RouteComponentProps): JSX.Element {
  const PREVIEW_TOKEN_KEY = 'token';
  const PREVIEW_SERVER_ID_KEY = 'server-id';
  // Read a token and server id from the query string
  const searchParams = new URLSearchParams(location.search);
  const queryToken = searchParams.get(PREVIEW_TOKEN_KEY);
  const queryServerId = searchParams.get(PREVIEW_SERVER_ID_KEY);

  const cookies = cookie.parse(document.cookie);

  // Make priority to values from query string because in cookies they might be outdated.
  const authorizationToken = queryToken ?? cookies[PREVIEW_TOKEN_KEY];
  const serverId = queryServerId ?? cookies[PREVIEW_SERVER_ID_KEY];

  // Save the values from the query string to have ability to restore them when switch back from legacy page to the SPA-SDK rendered page.
  if (queryToken) document.cookie = cookie.serialize(PREVIEW_TOKEN_KEY, queryToken);
  if (queryServerId) document.cookie = cookie.serialize(PREVIEW_SERVER_ID_KEY, queryServerId);

  const configuration = {
    endpoint: process.env.REACT_APP_BRXM_ENDPOINT,
    endpointQueryParameter: 'endpoint',
    httpClient: axios,
    path: `${location.pathname}${location.search}`,
    // Provide authorization token and server id if they exist to the SPA-SDK initialization method.
    ...(authorizationToken ? { authorizationToken } : {}),
    ...(serverId ? { serverId } : {}),
  };
  const mapping = { Banner, Content, 'News List': NewsList, 'Simple Content': Content };

  return (
    <BrPage configuration={configuration} mapping={mapping}>
    {/**/}
    </BrPage>
  );
};
```
```javascript Vue (JS)
import cookie from 'cookie';

@Component({
  data(this: App) {
    const PREVIEW_TOKEN_KEY = 'token';
    const PREVIEW_SERVER_ID_KEY = 'server-id';
    // Read a token and server id from the query string
    const queryToken = this.$route.query[PREVIEW_TOKEN_KEY] as string;
    const queryServerId = this.$route.query[PREVIEW_SERVER_ID_KEY] as string;

    const cookies = cookie.parse(document.cookie);

    // Make priority to values from query string because in cookies they might be outdated.
    const authorizationToken = queryToken ?? cookies[PREVIEW_TOKEN_KEY];
    const serverId = queryServerId ?? cookies[PREVIEW_SERVER_ID_KEY];

    // Save the values from the query string to have ability to restore them when switch back from legacy page to the SPA-SDK rendered page.
    if (queryToken) document.cookie = cookie.serialize(PREVIEW_TOKEN_KEY, queryToken);
    if (queryServerId) document.cookie = cookie.serialize(PREVIEW_SERVER_ID_KEY, queryServerId);

    return {
      configuration: {
        baseUrl: process.env.BASE_URL !== '/' ? process.env.BASE_URL : '',
        endpoint: process.env.VUE_APP_BRXM_ENDPOINT,
        endpointQueryParameter: 'endpoint',
        httpClient: axios,
        path: this.$route.fullPath,
        // Provide authorization token and server id if they exist to the SPA-SDK initialization method.
        ...(authorizationToken ? { authorizationToken } : {}),
        ...(serverId ? { serverId } : {}),
      },
      mapping: {
        Banner,
        Content,
        menu: Menu,
        'News List': NewsList,
        'Simple Content': Content,
      },
    };
  },
})
export default class App extends Vue {
  ...
}
```

> 🚧 Important
>
> * The preview site should be served on a separate domain compared to the live site to avoid saving preview related cookies for the live site.
> * In case, when the first page which is loading in preview doesn't use SPA SDK you should parse query parameters and save preview related data to the cookies by yourself.

## The Experience manager shows an incorrect project name

The project name displayed in the project selector does not match the project displayed in the channel preview.

#### Reason

The most likely reason is that the channel preview requests by the Experience manager are being cached by the SPA.

When the user switches to a different project, the selected project is updated in the server's session context, and the Experience manager reloads the page, expecting the reloaded page to be driven by a project-specific Delivery API response. However, due to the caching in place, the page reload never hits the server, and the selected project is not reflected correctly on the previewed page.

#### Solution

Ensure your SPA does not cache any pages in a preview context in the Experience manager. Preview page requests always include a `token` request parameter, for example:

```http
https://example-spa.example.com/?token=eyJhbGciOiJSUzI1NiJ9.eyJzdWIiOiI5MzBlYzY3NC01NzgyLTQ1MDEtYThmMS02M2VhYmJmOTdhMmQifQ.WTB0636SnSKPbZO0ldUTc8arjFkWj1piU0tVXpGptzhNmwzizX_16YGBW1SvmP4xP34x18v4jBJuOeppsZuGO2RbyhgXKfZ2-_HKl9r7XLNW-FRrUYLijUbY1I2t-wUjnSGzm2hhGoHOk4CP9KrsQEJXKlZ4ijX3wjwXTOsfVZOguhKPGr45n2XUEy5CYor7YDkN_2YCmjoXn3BKyOnkeGlZC_uVJvo0jReB299ICxWth5fOFeNZYcA55CtT66i8H-GIHUHrVoZDikhRcQfkjkgO4NbRanx9Oj1Z3hP025RPycewaXxglSRBSu8FCYYlw6mMF1Tk--k2PndyZg3YvQ&server-id=cms-green-techdoc-development-gloo-one-7958d4588d-7tptn&endpoint=https://example-account.bloomreach.io/delivery/site/v1/channels/example-channel/pages
```

These requests should never be cached at the SPA level.

In addition, ensure that preview responses don't include any headers triggering the browser to cache those responses.

## Channel toolbar is not initialized

Inside the Experience manager, the channel toolbar is not appearing (see screenshot below), but the SPA is fully functioning.

[block:image]
{
  "images": [
    {
      "image": [
        "https://files.readme.io/963a221-troubleshooting-outdated-configuration.png",
        "",
        "Channel toolbar is not initialized."
      ],
      "align": "center",
      "caption": "Channel toolbar is not initialized."
    }
  ]
}
[/block]

#### Reason

* The SPA is loading components asynchronously but doesn't call the .sync() function after the page has loaded.
* The Delivery API request in the Experience manager is missing the following headers: `Authorization` and `Referer`.

#### Solution

* If the SPA is loading components asynchronously, call the `.sync()` function after the page has loaded. See <https://bloomreach.github.io/spa-sdk/interfaces/index.Page.html> for details.
* Check in the SPA configuration if the request option doesn’t have a hard coded path, e.g.: `request: { path: '/' }`.