1

I'm making a website by using next.js. After deploying my project by Vercel, login api gives me 502 error.

const nextConfig = {
  reactStrictMode: true,
  images: {
    domains: [process.env.ORIGINAL_DATA, process.env.CONVERT_DATA]
  },
  swcMinify: true,
  env: {
    ORIGINAL_DATA : `https://${process.env.ORIGINAL_DATA}`,
    CONVERT_DATA : `https://${process.env.CONVERT_DATA}`,
  },
  async rewrites() {
    return [
      {
        source: "/api/:path*",
        destination: `http://${process.env.API}api/:path*`,
      },
      {
        source: "/video/:filename*",
        destination: `https://${process.env.CONVERT_DATA}:filename*`,
      }
    ]
  },
}

My config codes are here. In development mode, it does work. Does anyone know why this is happening?? is there something wrong in rewrites fnc??

I double checked env variables... I've cleaned cache and cookies...

John Kim
  • 11
  • 1
  • Self-Solved : my env API was something like "44.222.222.200:3333/" and I changed it to "http://http://44.222.222.200:3333/api/:path*" and just left process.env.API for destination. it works. does anyone know why?? – John Kim Nov 08 '22 at 09:55

0 Answers0