{"id":17921,"library":"rendertron-middleware","title":"Rendertron Express Middleware","description":"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.","status":"abandoned","version":"0.1.5","language":"javascript","source_language":"en","source_url":null,"tags":["javascript","typescript"],"install":[{"cmd":"npm install rendertron-middleware","lang":"bash","label":"npm"},{"cmd":"yarn add rendertron-middleware","lang":"bash","label":"yarn"},{"cmd":"pnpm add rendertron-middleware","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Required web framework for the middleware to function. This middleware integrates directly into an Express application chain.","package":"express","optional":false}],"imports":[{"note":"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.","wrong":"const makeMiddleware = require('rendertron-middleware').makeMiddleware;","symbol":"makeMiddleware","correct":"import { makeMiddleware } from 'rendertron-middleware';"},{"note":"An array of default bot user-agents used by the middleware. Useful for extending or overriding the default patterns.","wrong":"const botUserAgents = require('rendertron-middleware').botUserAgents;","symbol":"botUserAgents","correct":"import { botUserAgents } from 'rendertron-middleware';"}],"quickstart":{"code":"import express from 'express';\nimport { makeMiddleware } from 'rendertron-middleware';\n\nconst app = express();\n\n// Configure the Rendertron middleware\napp.use(makeMiddleware({\n  // IMPORTANT: Replace with the actual URL of your deployed Rendertron instance.\n  // e.g., 'https://my-rendertron-service.appspot.com/render'\n  proxyUrl: process.env.RENDERTRON_PROXY_URL ?? 'http://localhost:8081/render',\n  // Optional: Custom User-Agent pattern regex for bots to proxy\n  // userAgentPattern: new RegExp(['googlebot', 'bingbot'].join('|'), 'i'),\n  // Optional: URL path components to exclude from prerendering\n  // excludeUrlPattern: new RegExp('\\.(js|css|gif|jpg|png|ico|svg)$', 'i'),\n  // Optional: Millisecond timeout for the proxy request to Rendertron\n  // timeout: 15000\n}));\n\n// Serve your static files or application routes AFTER the middleware\napp.use(express.static('public'));\n\nconst PORT = process.env.PORT || 8080;\napp.listen(PORT, () => {\n  console.log(`Web server listening on port ${PORT}`);\n  console.log('Rendertron middleware active.');\n});\n","lang":"typescript","description":"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."},"warnings":[{"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.","message":"The 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.","severity":"breaking","affected_versions":">=0.1.0"},{"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'`.","message":"The `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.","severity":"gotcha","affected_versions":">=0.1.0"},{"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.","message":"Older 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.","severity":"gotcha","affected_versions":">=0.1.0"},{"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.","message":"The `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.","severity":"gotcha","affected_versions":">=0.1.0"}],"env_vars":null,"last_verified":"2026-04-23T00:00:00.000Z","next_check":"2026-07-22T00:00:00.000Z","problems":[{"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' }));`","cause":"The `proxyUrl` property was not provided or was an empty string in the `makeMiddleware` configuration object.","error":"Error: Missing proxyUrl configuration"},{"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`.","cause":"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.","error":"Bots are not receiving pre-rendered content / My pages are not indexed by search engines."}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}