Error with Axios: Response to preflight request doesn't pass access control check: Redirect is not allowed for a preflight request

Hi guys! i hope all of us are well,

In this time a bring good news, i can resolve the problem. I show us how i make it.

I set a http method OPTIONS because in my network tab the first method was return it is also i wrap my function with middy cors.

In my axios petition i declare a both of headers

And my last step if make a proxy in my nextjs config, this entry point to my endpoint

I hope this can be of help, thank you a lot for your help!