nextjs中代理请求到指定域名

在next.config.js中,通过配置rewrites fallback来把请求代理到指定域名

module.exports = {
  ...
  async rewrites() {
    return {
      fallback: [
        {
          source: '/:path*',
          destination: `https://host/:path*`,
        },
      ],
    }
  }
}
posted @ 2022-11-17 17:21  小菜菜爱吃菜  阅读(812)  评论(0编辑  收藏  举报