{"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.","language":"javascript","status":"abandoned","last_verified":"Thu Apr 23","install":{"commands":["npm install rendertron-middleware"],"cli":null},"imports":["import { makeMiddleware } from 'rendertron-middleware';","import { botUserAgents } from 'rendertron-middleware';"],"auth":{"required":false,"env_vars":[]},"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.","tag":null,"tag_description":null,"last_tested":null,"results":[]},"compatibility":null}