rankdeploy-middleware
v1.3.2
Published
SEO middleware for Rank Deploy — serves pre-rendered HTML to search engine bots
Maintainers
Readme
@rankdeploy/middleware
SEO middleware that serves pre-rendered HTML to search engine bots. Human visitors are not affected.
Install
npm install @rankdeploy/middlewareNext.js / Vercel
// middleware.ts (at project root)
export { middleware, config } from '@rankdeploy/middleware/next'That's it. One line.
Netlify
// netlify/edge-functions/rankdeploy.ts
export { default } from '@rankdeploy/middleware/netlify'Add to netlify.toml:
[[edge_functions]]
function = "rankdeploy"
path = "/*"Express.js
import { rankdeploy } from '@rankdeploy/middleware/express'
app.use(rankdeploy())Custom Options
import { createMiddleware } from '@rankdeploy/middleware/next'
export const middleware = createMiddleware({
// Custom API URL (default: https://proxy.unikium.com)
apiUrl: 'https://proxy.unikium.com',
// Extra bot user agents to detect
extraBots: ['my-custom-bot'],
// Paths to exclude from pre-rendering
excludePaths: ['/api', '/admin', '/dashboard'],
})How it works
- A request comes in
- The middleware checks the User-Agent header
- If it's a search engine bot (Google, Bing, etc.):
- Fetches pre-rendered HTML from Rank Deploy API
- Returns optimized HTML with injected SEO tags
- If it's a human visitor:
- Request passes through unchanged
- Zero performance impact
Supported bots
Google, Bing, Yandex, DuckDuckGo, Baidu, Facebook, Twitter/X, LinkedIn, WhatsApp, Telegram, Slack, Discord, Pinterest, Ahrefs, SEMrush, Moz, GPTBot, Claude, Perplexity, and more.
