Prerender for Decoupled Drupal

Does Prerender work with decoupled Drupal?

Prerender works with decoupled Drupal websites that use a separate JavaScript frontend and allow crawler requests to be routed to Prerender’s service through the frontend’s server, reverse proxy, or CDN. For an Express connection, the Express server must serve the public website pages. Managed frontend hosting requires confirmation from the provider that this routing is supported.

Prerender and decoupled Drupal compatibility at a glance

| Your setup | Prerender compatibility |

| --- | ------ |

| Fully decoupled frontend served by a customer-controlled Express server | Candidate for the documented Node.js connection, subject to host permission, public rendering access, and a rendering gap. |

| Fully decoupled frontend served through customer-controlled Nginx or Apache | Assess the documented connection for the server actually receiving public page requests. |

| Fully decoupled frontend behind customer-controlled Cloudflare | Assess the Worker connection, including proxy status, Worker access, and frontend-host permission. |

| Managed frontend with restricted server or CDN access | Requires the provider to identify a permitted connection. Drupal administration access alone is insufficient. |

| Frontend already returning essential content through SSR or static generation | May need no additional rendering. Inspect representative HTML responses first. |

| Traditional Twig-rendered Drupal or progressively decoupled Drupal | Assess the HTML Drupal already returns and any remaining JavaScript-dependent content. |

How Prerender supports ‘machine experience’

A decoupled Drupal frontend may load article text, category links, headings, or metadata through JavaScript. If that content is absent from the initial HTML, machines that do not execute JavaScript may receive an incomplete page. This affects machine experience: what machines receive when requesting your website. A frontend using SSR or static generation may already supply the essential HTML.

Prerender renders accessible JavaScript pages and caches the resulting HTML. The configured frontend server routes eligible crawler requests to Prerender’s service and returns rendered HTML. Visitors continue through the normal frontend flow. Read more about how Prerender renders and caches pages.

How to connect Prerender to decoupled Drupal

1. Choose the connection for your frontend and host

Identify the component serving public article, category, and landing-page URLs. The Drupal content backend may run on a different host from the frontend.

Drupal’s core JSON:API module (jsonapi) can expose content entities to a separate frontend. Access to that API does not establish access to the server handling public page requests. Drupal API options

Choose the connection that matches the public request path:

  • Express: Use the procedure below when an editable Express server receives public frontend requests. An Express server handling only API calls does not qualify.
  • Nginx: Assess the SPA or reverse-proxy configuration in the Nginx installation guide.
  • Apache: Confirm access to the virtual host, rewrite configuration, and required modules before following the Apache installation guide.
  • Cloudflare: Confirm a proxied frontend domain, Worker administration access, and host permission before following the Cloudflare Worker installation guide. Disable Automatic Signed Exchanges in Cloudflare before activating the Prerender connection.

A managed Drupal backend does not establish whether a separately hosted frontend permits any of these connections. Confirm permissions with the provider responsible for each affected layer.

2. Configure the assessed Express connection

For an approved frontend served by Express:

  1. Confirm permission to change and deploy the frontend server and make outbound HTTPS requests to Prerender’s service.

  2. Install the package in the frontend server project:

npm install prerender-node --save

  3. Store the token as PRERENDER_TOKEN in the server environment.

  4. Register the middleware before handlers that return public frontend pages:

app.use(
  require('prerender-node')
    .set('prerenderToken', process.env.PRERENDER_TOKEN)
);

  5. Limit rendering to intended public content routes. Exclude backend APIs, administration, authentication, previews, and private or transactional routes.

  6. Save, deploy, and restart the application using your host’s normal process.

The middleware example follows the Node.js and Express installation guide. It belongs in the server receiving page requests, not in a browser-side React or Vue bundle.

Before deployment, review DNS targets, TLS certificates, origin hostname/SNI, Host and forwarded headers, redirects, and asset delivery. Confirm that the URL submitted for rendering uses the intended public HTTPS domain and preserves its path, query, site, and language.

Behind a proxy, validate how the middleware reconstructs the public URL. The package provides host and protocol settings where explicit values are appropriate; assess them against the deployment’s domain structure. Public-route inclusion and exclusion options are documented in the package reference.

3. Inspect and extend crawler coverage

Inspect prerender.crawlerUserAgents in the installed node_modules/prerender-node/index.js, together with application code that changes that list.

The current upstream source includes these case-insensitive matches; your deployed package may differ:

| Crawler | Match to check |

| --- | ------ |

| Googlebot | googlebot |

| GPTBot | GPTBot |

| ClaudeBot | claudebot |

| PerplexityBot | Perplexitybot |

Preserve the middleware’s X-Prerender request bypass and static-file exclusions. Rendering requests must reach the frontend without returning recursively to Prerender’s service. These behaviors are visible in the current middleware source.

For versions exposing addUserAgents, append missing matches to the existing middleware registration:

app.use(
  require('prerender-node')
    .set('prerenderToken', process.env.PRERENDER_TOKEN)
    .addUserAgents([
      'googlebot',
      'gptbot',
      'claudebot',
      'perplexitybot'
    ])
);

Retain your public-route restrictions. addUserAgents preserves the existing crawler list; setting crawlerUserAgents replaces it. Save, redeploy, and restart the application, then test each crawler separately. See additional crawler configuration.

Review firewall rules, bot challenges, AI crawler controls, rate limits, and caches acting before Express. An eligible user agent cannot reach Prerender if an earlier layer blocks or answers the request.

How to verify what crawlers receive

Request a public article or category URL with a configured crawler user agent:

curl -i -A "Googlebot" "https://www.example.com/news/example-article"

Replace the example with your public frontend URL. The command retrieves response headers and the HTML body.

Check handling and content together:

  • Look for x-prerender-request-id and the corresponding request in Prerender’s CDN Analytics.
  • Inspect the returned HTML for article text or category content, headings, links, title, description, canonical URL, and correct site/language context.
  • Check status codes and redirects. A successful status alone does not prove complete rendering.
  • Compare the essential content with the public page visitors receive.

The header and dashboard checks are described in the Prerender verification guide.

Repeat the request separately with GPTBot, ClaudeBot, and PerplexityBot. Test a fresh or refreshed render and a subsequent cached response. After changing Drupal content, confirm that the updated frontend content reaches the rendered response.

Also test a normal visitor request and a rendering request carrying X-Prerender to confirm the bypass. Check that outer caches do not mask routing changes or mix visitor and crawler responses.

Simulated user agents test routing conditions. Review actual crawler logs where available to confirm that real requests pass IP checks and other security controls.

Requirements and limitations

  • Permitted frontend routing: You need access to the layer serving public pages and permission to route eligible requests externally.
  • Reachable content: Prerender must load the public frontend and its required scripts, styles, images, and data. API access and any cross-origin restrictions must allow the frontend to render correctly.
  • Correct domain behavior: Preserve public URLs, TLS, redirects, assets, and language selection across the full request path.
  • Public content scope: Keep unpublished content, authenticated pages, previews, and backend endpoints outside rendering scope.
  • Coordinated caching: Review Drupal/API, frontend, CDN, and Prerender caches. Drupal cache invalidation alone does not establish that rendered HTML has refreshed.
  • A demonstrated rendering gap: Adding Prerender may provide no rendering benefit when the existing response already contains essential content.
  • Crawler access: Rendered HTML does not override crawler restrictions or guarantee indexing, rankings, Google News inclusion, or AI citations.

For blocked fetches, routing failures, or incomplete output, use the Prerender troubleshooting guide.

Get help with your Prerender and decoupled Drupal setup

Prerender support can help assess whether your decoupled Drupal website needs additional rendering, identify a suitable connection, and verify what crawlers receive.

FAQs about Prerender and decoupled Drupal

Decoupled Drupal setups that can use Prerender include public frontends served through a configurable Express server, Nginx, Apache, or Cloudflare connection, subject to host permission and rendering access. The connection must handle public page requests and match the deployment’s architecture.

A decoupled Drupal frontend can use the Express connection if an editable Express server receives its public page requests and the host permits routing to Prerender’s service. A Node.js build process or an Express server serving only backend APIs does not meet that requirement.

Connecting Prerender through a managed Drupal host requires confirmation from that provider that the required crawler routing is available and supported. If the public frontend runs elsewhere, its hosting provider and routing layer determine the frontend connection.

Decoupled Drupal may not need Prerender if SSR or static generation already returns the essential content crawlers need. Inspect representative article, category, and language-specific responses before adding another rendering layer.

Traditional or progressively decoupled Drupal may use a suitable server or proxy connection, but their rendering and request paths require separate assessment. Standard Drupal uses Twig templates to produce HTML, so a rendering gap should be demonstrated first. Drupal template rendering

Prerender does not replace Drupal’s content APIs. The decoupled frontend continues to obtain content through its existing data flow, while eligible crawler requests receive rendered HTML through the configured frontend connection.

Get in contact with our expert team