Observability
When something routes wrong, you need to know why. Debug headers, observability dashboards, and session traces show exactly what happened to each request.
Outcome
Enable and use debug headers to inspect routing decisions, and view microfrontends data in Vercel Observability.
Debug Headers
When debug mode is enabled, responses include headers showing routing decisions:
| Header | Description |
|---|---|
x-vercel-mfe-app | Which app handled the request |
x-vercel-mfe-matched-path | Which routing pattern matched |
x-vercel-mfe-target-deployment-id | Deployment that served the request |
x-vercel-mfe-default-app-deployment-id | Default app's deployment ID |
x-vercel-mfe-zone-from-middleware | App chosen by middleware (flagged paths) |
x-vercel-mfe-response-reason | Internal routing reason |
Fast Track
- Enable debug mode via cookie or Vercel Toolbar
- Inspect response headers in DevTools
- View routing data in Observability dashboard
Hands-on Exercise 3.3
Enable debug mode and trace a request through the microfrontends layer.
Part 1: Enable Debug Mode
Option A: Set a cookie
In your browser's DevTools console:
document.cookie = "VERCEL_MFE_DEBUG=1; path=/";Refresh the page. Now all responses include debug headers.
Option B: Use Vercel Toolbar
If you have the Vercel Toolbar installed:
- Click the Vercel icon in the toolbar
- Open the "Microfrontends" panel
- Toggle "Enable Debug Mode"
Part 2: Inspect Response Headers
- Open DevTools → Network tab
- Visit your deployed Vercel URL (e.g.,
acme-platform.vercel.app/docs) - Click on the document request
- Look at Response Headers:
x-vercel-mfe-app: docs
x-vercel-mfe-matched-path: /docs/:path*
x-vercel-mfe-target-deployment-id: dpl_abc123xyz
x-vercel-mfe-default-app-deployment-id: dpl_def456uvw
This tells you:
- The
docsapp handled this request - It matched the
/docs/:path*pattern - The specific deployment IDs involved
Part 3: View Observability Dashboard
- Go to your Vercel dashboard
- Click the Observability tab
- In the left sidebar, find CDN → Microfrontends
The dashboard shows:
- Requests by app - Which apps are handling traffic
- Matched paths - Which routing patterns are being used
- Response times - Performance by app
Part 4: Capture a Session Trace
Session tracing shows the full lifecycle of a request:
- In Vercel Observability, click Sessions
- Start a new session or find a recent one
- Make a request to your microfrontends URL
- Find the request in the session
- Expand the Microfrontends span
The span includes attributes:
| Attribute | Description |
|---|---|
vercel.mfe.app | Project that handled the request |
vercel.mfe.target_deployment_id | Deployment ID |
vercel.mfe.default_app_deployment_id | Default app deployment |
vercel.mfe.matched_path | Matched routing pattern |
vercel.mfe.app_from_middleware | Middleware decision (if flagged) |
Debugging Common Issues
"Wrong app is serving this path"
Check the headers:
Request: /docs/api
Expected: docs app
Actual header: x-vercel-mfe-app: marketing
Diagnosis: The path pattern isn't matching. Check microfrontends.json:
"@acme/docs": {
"routing": [
{ "paths": ["/docs", "/docs/:path*"] }
]
}"Redirect isn't working"
Remember the execution order:
Microfrontends → Headers → Redirects → Middleware → Rewrites
If your redirect is in the marketing app but the path routes to docs, the redirect never runs.
Check: Which app does the path route to?
x-vercel-mfe-app: docs // Redirect needs to be in docs app!
"Middleware isn't running"
Middleware only runs for paths routed to that app.
Request: /app/dashboard
x-vercel-mfe-app: dashboard
If middleware isn't running, check:
- Is middleware in the correct app (dashboard)?
- Does the middleware matcher include this path?
Creating a Debug Helper
Add a debug endpoint to quickly check routing:
Create apps/marketing/app/api/debug/route.ts:
import { headers } from "next/headers";
export async function GET() {
const headersList = await headers();
const debugInfo = {
app: "marketing",
timestamp: new Date().toISOString(),
headers: {
"x-vercel-mfe-app": headersList.get("x-vercel-mfe-app"),
"x-vercel-mfe-matched-path": headersList.get("x-vercel-mfe-matched-path"),
"x-vercel-deployment-id": headersList.get("x-vercel-deployment-id"),
},
};
return Response.json(debugInfo);
}Visit /api/debug to see routing info as JSON.
Commit
git add -A
git commit -m "feat: add debug API endpoint for routing inspection"Done-When
- Debug mode enabled (cookie or toolbar)
- Can see
x-vercel-mfe-appheader in DevTools - Viewed microfrontends data in Observability dashboard
- Understand how to trace routing decisions
Observability Checklist
When debugging microfrontends issues:
- Enable debug headers - See which app handled the request
- Check matched path - Verify the pattern is correct
- Compare deployment IDs - Ensure the right deployment is serving
- View session trace - See the full request lifecycle
- Check middleware - Confirm it ran (or didn't, and why)
What's Next
Configure deployment protection and firewall rules that work across microfrontends.
Was this helpful?