caddy-spa-api-proxy-deploy

Configure Caddy reverse proxy routing for Vite SPAs and Bun APIs in Docker.

2|Updated May 10, 2026
One-click install
npx skills add https://github.com/freedomw1987/tree_monstor --skill caddy-spa-api-proxy-deploy
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: caddy-spa-api-proxy-deploy
Source: https://github.com/freedomw1987/tree_monstor/tree/main/skills/devops/caddy-spa-api-proxy-deploy
Command: npx skills add https://github.com/freedomw1987/tree_monstor --skill caddy-spa-api-proxy-deploy

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This skill eliminates the manual effort and common errors of configuring reverse proxies, SPA routing fallback, and Docker host networking for full-stack applications combining Vite frontends and Bun backends, preventing issues like broken SPA routes and mismatched API proxy prefixes.

Core Features & Use Cases

  • Caddy Reverse Proxy Setup: Automates routing configuration to direct SPA traffic to the Vite preview server and API traffic to the Bun backend with correct prefix handling.
  • Docker Networking Resolution: Fixes common Docker host networking issues like failed host.docker.internal resolution for Caddy containers.
  • SPA Fallback Guarantee: Ensures proper SPA routing by using Vite preview instead of basic static servers that return 404s for client-side routes. Use case: Full-stack developers deploying Vite + Bun applications can use this skill to avoid manual proxy configuration errors and get their app live in minutes.

Quick Start

Use the caddy-spa-api-proxy-deploy skill to configure a Caddy reverse proxy in Docker with host networking for your Vite SPA frontend and Bun API backend, including correct API prefix routing and SPA fallback support.

Frequently Asked Questions about caddy-spa-api-proxy-deploy

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I deploy a Vite SPA and Bun API behind a Caddy reverse proxy in Docker?

To deploy a Vite SPA and Bun API behind Caddy in Docker, route SPA traffic to the Vite preview server and API traffic to the Bun backend. This configuration ensures correct API prefix stripping and SPA fallback handling.

Why does my Vite SPA return 404 errors for client-side routes when using a reverse proxy?

Vite SPA routes return 404 errors when basic static servers lack SPA fallback support. Using the Vite preview server behind your Caddy reverse proxy guarantees proper client-side routing fallback and resolves missing route errors.

How do I fix failed host.docker.internal resolution for Caddy containers?

Fixing failed host.docker.internal resolution for Caddy containers involves implementing Docker host IP resolution within your reverse proxy configuration. This ensures the Caddy container correctly communicates with your Bun API backend.

Does this Caddy reverse proxy configuration handle API prefix stripping for Bun backends?

Yes, the Caddy reverse proxy configuration handles API prefix stripping for Bun backends. It automatically directs prefixed API backend traffic correctly, preventing mismatched API proxy prefixes during full-stack deployment.

Can I use a basic static server instead of Vite preview for SPA deployment behind Caddy?

Using a basic static server instead of Vite preview for SPA deployment behind Caddy is not recommended. Vite preview guarantees proper SPA fallback for client-side routes, whereas basic static servers return 404s.