404 Error on Root Path with Correct Static File Config

Hello Vercel Community and Support Team,

I am experiencing a persistent 404 Not Found error on the root path of my project, even after extensive troubleshooting. My goal is to serve a simple static index.html file from the /public directory, alongside a serverless function in /api.

Project Details:

My vercel.json Configuration:
I am using a very explicit configuration to ensure the build and routing are correct, but the issue persists.

{
  "version": 2,
  "builds": [
    {
      "src": "api/proxy.js",
      "use": "@vercel/node"
    },
    {
      "src": "public/**",
      "use": "@vercel/static"
    }
  ],
  "rewrites": [
    {
      "source": "/api/proxy/(.*)",
      "destination": "/api/proxy"
    }
  ]
}

Troubleshooting Steps Already Taken:
I believe I have exhausted all possible user-side solutions, including:

  1. Verified File Structure: Confirmed index.html is correctly located inside /public, all with correct lowercase naming.
  2. Multiple Configs: Tried several vercel.json configurations, from simple rewrites to explicit builds and routes. The current one is the most explicit.
  3. Verified Build Output: Checked the deployment’s “Output” tab, which correctly shows both the static/index.html file and the api/proxy.js function. This indicates the build process is working as expected.
  4. Complete Project Reset: I completely deleted the old Vercel project and the old GitHub repository.
  5. Created a New Project: I created a brand new, clean GitHub repository (rht-final-panel) and a brand new Vercel project from scratch, using Vercel’s default settings and only adding environment variables.

Despite all these steps, the 404 error on the root path (/) continues to happen. This seems to be a platform-level issue with static file routing for my project, as the code, configuration, and build output all appear to be correct.

Could anyone from the Vercel team or the community investigate why a request to the root path is not being served by the public/index.html file present in the build output?

Thank you for your help.

There’s another community post with 404 debugging tips that might be helpful. Please give these solutions a try and let us know how it goes.

A human should be around soon to offer more advice. But you can also get helpful information quickly by asking v0.

Have you had the chance to check out the 404 post?

1 Like

Hi @zwy22679-3614, I was able to get the app working by updating the vercel.json to:

{
  "version": 2,
  "rewrites": [
    {
      "source": "/api/proxy/(.*)",
      "destination": "/api/proxy"
    }
  ]
}

Here’s my deployed version: https://rht-final-panel-beryl.vercel.app/

Let me know if this resolves your issue.

2 Likes

Hi Anshuman,

Thank you so much! I can confirm that after I updated my vercel.json to the simple configuration you provided and redeployed, it is now working perfectly.

I really appreciate your help!

1 Like

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