Manifest Cors error

Don’t know if anyone has had this issue but I’m adding a manifest file in my root and adding it to my index file and when running dev server getting a CORs error even though it’s all in the same directory… Guessing some kind of processing is going on as works fine locally with live server?

1 Like

Did you ever resolve the CORS error?

No… Unfortunately not… Do you have a solution?

1 Like

No, I was just about to ask essentially the same question, which I thought would be extremely basic:

IDX + Static Website + PWA w/ service worker + CORS = how?

I have seen other “remotely” similar questions (pardon the pun), which references their guidance for full stack programming, which includes credential passing. But in my case, I just want to add a manifest.json file + service worker to a static website in order to make that site a PWA. I don’t have a back end to connect to, just the static site. I can actually manually navigate to the manifest.json and it will serve it to my browser, as it is in the same root directory as index.html. But it throws the CORS errors before any of my scripts are even running (so it isn’t a problem with the service worker code). My best guess is that when parsing the index.html it tries to load the manifest via the <link rel="manifest" href="manifest.json"> line, and that is where the CORS is blocking it.

I would have thought that PWA’s were a primary use case for Project IDX, so I was a bit surprised when I couldn’t find any documentation for this particular problem. I was hoping that you had fixed it and just hadn’t posted it!!

For CORS it depends on how you are serving the website and where you are viewing it.

Try using the public port and opening up the signed url in a new tab to see if the CORS issue goes away.

If that doesnt work you can setup a reverse proxy to have all the requests go through the same domain

I’m even getting it through vite.

I’ll try your suggestion

For vite you can set custom headers, but you might need a cors package to handle the preflight requests