Frameworks8 min read
Deploy Static Sites
Deploy static sites and SPAs (React, Vue, Svelte, Astro) with edge caching, custom headers, and SPA fallback.
1.Build Output Configuration
Configure your static site generator output for Oxaploy.
- Next.js: output: 'export' in next.config.js → outputs to out/
- Vite: build.outDir: 'dist' in vite.config.js
- Astro: output: 'static' in astro.config.mjs
- React/Vue: npm run build outputs to build/ or dist/
- Set build command to output static files to a known directory
2.SPA Routing Fallback
Configure single-page application routing for client-side routing.
- Enable SPA Fallback in app settings
- Oxaploy serves index.html for all non-file routes
- Client-side router handles navigation (React Router, Vue Router, etc.)
- API routes should be prefixed (e.g., /api/*) to avoid conflicts
3.Custom Headers and Caching
Optimize delivery with custom headers and cache control.
- Static assets: Cache-Control: public, max-age=31536000, immutable
- HTML: Cache-Control: no-cache, must-revalidate
- Security headers: CSP, HSTS, X-Frame-Options via Oxaploy settings
- Custom headers: configure in app settings → Headers tab
4.Edge Optimization
Leverage edge caching for global performance.
- Oxaploy serves static assets from edge locations
- Configure Cache-Control for optimal edge caching
- Use stale-while-revalidate for seamless updates
- Purge cache on new deployments automatically