NextJS应用访问问题

环境:NextJS, Redis, Nginx

后台日志出现: header with value `***` does not match `origin` header with value `localhost:3000` from a forwarded Server Actions request. Aborting the action.

方法一:在next.config.js文件添加下面内容

/** @type {import(‘next’).NextConfig} */
const nextConfig = {
experimental: {
serverActions: {
allowedOrigins: [“website.com”, “localhost:3000”]
}
}
}

module.exports = nextConfig

 

方法二:在nginx的配置文件default添加

proxy_pass http://127.0.0.1:3000/;
proxy_set_header x-forwarded-host <domain_name>;