Error in fetch with ec2 server and netlify

Hey guys. i deployed an next js application here in netlify and a server in ec2.

in the server’s cors option, i put this

const corsOptions: CorsOptions = {
    origin:
        process.env.NODE_ENV === 'development'
            ? 'http://localhost:3000'
            : 'https://portifolio-luis.netlify.app',
}

app.use(cors(corsOptions))

and the ec2 server security group are able to http and https request.

and in my next application, in the file next.config.js, i made this rewrites:

async rewrites(){
   return[{
        source:'/',
        destination:'https://ec2*****',
      }]
}

when i’m at localhost, everything works as expect… someone knows what i’m doing wrong?

I’m not sure you’ve explained the problem. What is not working as expected? What is the problem you’re seeing? How can we see the problem happen?