Skip to main content

Overview

Path Routing lets you serve Anymorph pages from specific paths (like /a/*) while keeping your existing site intact. No DNS changes required.
yourdomain.com/a/*  → Anymorph pages
yourdomain.com/*    → Your existing site

Prerequisites

  • Your workspace slug from Anymorph Dashboard
  • Your proxy URL: https://{slug}.proxy.anymorph.app

Platform Setup

Add rewrites to your vercel.json:
{
  "rewrites": [
    {
      "source": "/a/:path*",
      "destination": "https://your-slug.proxy.anymorph.app/a/:path*"
    }
  ]
}
Replace your-slug with your workspace slug, then deploy.
{
  "rewrites": [
    {
      "source": "/api/:path*",
      "destination": "https://api.example.com/:path*"
    },
    {
      "source": "/a/:path*",
      "destination": "https://your-slug.proxy.anymorph.app/a/:path*"
    }
  ]
}
{
  "rewrites": [...],
  "headers": [
    {
      "source": "/a/:path*",
      "headers": [
        {
          "key": "Cache-Control",
          "value": "public, max-age=3600, stale-while-revalidate=86400"
        }
      ]
    }
  ]
}

Testing

After setup, test your connection using the /__check__ endpoint:
curl https://yourdomain.com/a/__check__
Success response:
{"status": "connected", "domain": "yourdomain.com"}
Failure response:
{"status": "not_configured", "message": "Domain not found in proxy configuration"}
/__check__ only verifies the proxy connection. To confirm pages are deployed, visit the actual page path.

Custom Path Prefix

You can use any path prefix. Just update the source pattern:
{
  "rewrites": [
    {
      "source": "/compare/:path*",
      "destination": "https://your-slug.proxy.anymorph.app/a/:path*"
    }
  ]
}
Now yourdomain.com/compare/x-vs-y maps to your Anymorph page.

Troubleshooting

Your workspace slug is incorrect. Check the Anymorph Dashboard.
  • Verify the config file is in the correct location
  • Check for syntax errors
  • Redeploy after making changes
First requests may be slower. Enable caching for better performance.
Ensure your proxy configuration includes:
  • proxy_ssl_server_name on (Nginx)
  • HTTPS-only origin protocol (CloudFront)