Registry / http-networking / rendertron-middleware

rendertron-middleware

JSON →
library0.1.5jsnpmunverified

This package provides an Express middleware designed to facilitate dynamic rendering for web applications by integrating with a Rendertron service. It operates by inspecting incoming HTTP requests' User-Agent headers, and if a known bot or crawler is detected, it proxies the request to a separately deployed Rendertron instance. The Rendertron service, in turn, renders the page using a headless Chrome instance, returning static HTML suitable for search engines and social media bots that may not execute client-side JavaScript. The current stable version of this middleware is 0.1.5, which was last published over 7 years ago. The upstream Rendertron project itself has been officially deprecated since October 2022, with its maintainers stating that dynamic rendering is no longer the recommended approach for SEO. Consequently, this `rendertron-middleware` package is effectively abandoned and no longer maintained.

npm install rendertron-middleware
INSTALL
IMPORT
SIG · RENDERTRON-MIDDLEW
R
rendertron-middleware
http-networkingjavascriptv0.1.5
Install
—
Import
—
Disk
—
Pass rate
0/ 6
Env Coverage0 / 6
glibc
18–22
musl
18–22
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18–226 runs
build_error
glibc
node 18–226 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

makeMiddleware
✓ import { makeMiddleware } from 'rendertron-middleware';
✗ const makeMiddleware = require('rendertron-middleware').makeMiddleware;
While TypeScript types are shipped, the package primarily exposes a CommonJS module. Named imports are generally preferred for clarity in ESM contexts, but direct CommonJS `require` is also common.
botUserAgents
✓ import { botUserAgents } from 'rendertron-middleware';
✗ const botUserAgents = require('rendertron-middleware').botUserAgents;
An array of default bot user-agents used by the middleware. Useful for extending or overriding the default patterns.

Sets up an Express server with `rendertron-middleware` to proxy requests from detected bots to a specified Rendertron service, serving static files for other requests.

import express from 'express'; import { makeMiddleware } from 'rendertron-middleware'; const app = express(); // Configure the Rendertron middleware app.use(makeMiddleware({ // IMPORTANT: Replace with the actual URL of your deployed Rendertron instance. // e.g., 'https://my-rendertron-service.appspot.com/render' proxyUrl: process.env.RENDERTRON_PROXY_URL ?? 'http://localhost:8081/render', // Optional: Custom User-Agent pattern regex for bots to proxy // userAgentPattern: new RegExp(['googlebot', 'bingbot'].join('|'), 'i'), // Optional: URL path components to exclude from prerendering // excludeUrlPattern: new RegExp('\.(js|css|gif|jpg|png|ico|svg)$', 'i'), // Optional: Millisecond timeout for the proxy request to Rendertron // timeout: 15000 })); // Serve your static files or application routes AFTER the middleware app.use(express.static('public')); const PORT = process.env.PORT || 8080; app.listen(PORT, () => { console.log(`Web server listening on port ${PORT}`); console.log('Rendertron middleware active.'); });
Debug
Known issues
breakingThe main Rendertron project (GoogleChrome/rendertron) has been officially deprecated since October 2022. Dynamic rendering is no longer recommended for SEO, as modern search engines are capable of rendering JavaScript. This `rendertron-middleware` package is no longer maintained, and its use for SEO purposes is obsolete.
fix
Migrate to server-side rendering (SSR), static site generation (SSG), or ensure your client-side rendered application provides robust SEO for modern crawlers without dynamic rendering. Consider alternatives like Next.js, Nuxt.js, or similar frameworks that inherently support SSR/SSG.
affects: >=0.1.0
gotchaThe `proxyUrl` configuration property is mandatory and must point to a running instance of the Rendertron service. Failing to provide a valid URL will result in runtime errors or incorrect behavior where bot requests are not proxied.
fix
Always provide a `proxyUrl` in the `makeMiddleware` configuration object, pointing to your deployed Rendertron service. Example: `proxyUrl: 'https://my-rendertron-instance.appspot.com/render'`.
affects: >=0.1.0
gotchaOlder versions of the Rendertron service (especially 1.x.x and even 3.0.0 with specific bypasses) had known security vulnerabilities, including Server-Side Request Forgery (SSRF) and potential access to cloud metadata endpoints. Running an outdated or improperly configured Rendertron backend with this middleware could expose your infrastructure.
fix
Ensure your Rendertron instance (if still in use) is fully patched and configured with all recommended security measures, including domain allow-listing and blocking access to sensitive internal endpoints. However, the primary recommendation is to deprecate Rendertron usage entirely due to its abandoned status.
affects: >=0.1.0
gotchaThe `timeout` option in `rendertron-middleware` only controls the middleware's proxy request timeout. The actual rendering budget and timeout for the Rendertron service itself are configured separately on the Rendertron instance (e.g., via `config.json`). If the middleware's timeout is shorter than the Rendertron service's rendering budget, requests might fail prematurely on the middleware side, leading to non-prerendered content being served to bots without the Rendertron service actually failing to render.
fix
Align the `timeout` value in the middleware configuration with the `renderingBudgetMs` (or similar) setting on your Rendertron service. Ensure the middleware timeout is sufficiently long to allow the Rendertron service to complete rendering, or handle potential fallback logic for unrendered pages gracefully.
affects: >=0.1.0
Errors
Common errors & fixes
Error: Missing proxyUrl configuration
The `proxyUrl` property was not provided or was an empty string in the `makeMiddleware` configuration object.
fix
Set the `proxyUrl` in the middleware configuration to the full URL of your Rendertron render endpoint: `app.use(rendertron.makeMiddleware({ proxyUrl: 'http://your-rendertron-url/render' }));`
Bots are not receiving pre-rendered content / My pages are not indexed by search engines.
The `userAgentPattern` is not correctly matching the User-Agent string of the bot, or the `excludeUrlPattern` is inadvertently blocking requests from being proxied to Rendertron. Alternatively, the Rendertron service itself might be misconfigured or unreachable.
fix
Verify that your `userAgentPattern` regex correctly includes the User-Agents of the bots you want to target (e.g., `new RegExp('googlebot|bingbot', 'i')`). Check your `excludeUrlPattern` to ensure it's not filtering legitimate prerendering requests. Confirm your Rendertron service is running and accessible at the `proxyUrl`.
Upgrade
Version history
0.1.5latest on npm
Audit
Dependencies
expressrequiredRequired web framework for the middleware to function. This middleware integrates directly into an Express application chain.
Agent activity
9 hits · last 30 days
node
8
OpenAI (training)
1
Resources
rendertron-middleware — npm install rendertron-middleware · libregistry