It's easy with Caddy to setup it in a way that you can have your api and SPA app in under the same ___domain in order to avoid CORS-issues.
myapp.localhost {
tls internal
# Serve /api from localhost:3000 (your API)
@api path /api/*
handle @api {
# Remove the leading "/api" portion of the path
uri strip_prefix /api
reverse_proxy 127.0.0.1:3000
}
# Fallback: proxy everything else to Vite's dev server on 5173
handle {
reverse_proxy 127.0.0.1:5173
}
myapp.localhost { tls internal
}You're welcome.