CORS error with Fastapi and Nextjs

I have two separate repositories for my frontend and backend. My frontend uses NextJs and backend uses fastapi. I was building this project on my local machine but i decided to switch to project idx. But when I switched it to project idx then i got CORS error. I used withCredentials: true in my frontend axios code and CORS error resolved for get method. But for post method which have payloads it does not solve the issue. When i did it with a post method without payloads then there was no CORS error. But i’m getting the error with post request with payload. So, can anyone help me with this issue?

There is an ongoing issue with post requests if you use the public ports…

So, there’s no way! I have to use vs code instead