Flutter Web: /widget Redirect Issue on Vercel Subdomains

Hi Vercel community,

I have a unique issue with a Flutter web app deployment where subdomain routing behaves differently than the main domain:

Current Behavior:

Working Configuration for Main Domain:

{
    "version": 2,
    "name": "myapp",
    "rewrites": [
      {
        "source": "/(.*)",
        "destination": "/index.html"
      }
    ]
}

Technical Setup:

  • Flutter web application
  • GoRouter for client-side routing
  • PathUrlStrategy enabled
  • Multiple attempted subdomain rewrite rules, none successful

What I’ve Tried:

  1. Different rewrite patterns including negative lookaheads
  2. Host-based conditions in rewrites
  3. Various combinations of source/destination paths

Project Structure:

├── app/
│   └── index.html
├── public/
├── support/
└── vercel.json

This seems to be a specific edge case with Flutter web’s routing system interacting with Vercel’s subdomain handling. Has anyone encountered this or found a solution?

Thanks in advance!

The domain troubleshooting guide can help with most custom domain configuration issues. You might be able to use that guide to solve it before a human is available to help you. Then you can come back here and share the answer for bonus points.

You can also use v0 to narrow down the possibilities.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.