router
router copied to clipboard
Nginx 502 Bad Gateway error when proxying prerendered pages with Cloudflare Pages
Which project does this relate to?
Start
Describe the bug
When enabling prerendering for marketing pages in a TanStack Start application deployed to Cloudflare Pages, nginx reverse proxy returns 502 Bad Gateway errors when accessing these prerendered routes.
Your Example Website or App
/
Steps to Reproduce the Bug or Issue
- Enable prerendering in vite.config.ts:
tanstackStart({
target: 'cloudflare-pages',
pages: [
{ path: '/', prerender: { enabled: true, crawlLinks: false } },
{ path: '/about-us', prerender: { enabled: true, crawlLinks: false } },
{ path: '/careers', prerender: { enabled: true, crawlLinks: false } },
// ... other marketing pages
],
})
- Build the application: npm run build
- Deploy to Cloudflare Pages
- Set up nginx reverse proxy to Cloudflare Pages worker
- Access any prerendered route (e.g., /about-us)
Expected behavior
Prerendered pages should be served correctly through nginx proxy.
Screenshots or Videos
No response
Platform
- OS: macOS
- Browser: Chrome
Additional context
No response