我正在尝试发布一个 nextjs 应用程序,该应用程序将“next-auth”与 aws Cognito 结合使用。
当我在本地运行它时,使用next devORnext start它工作得很好。
当我在生产服务器(ubuntu,带有 nginx)上运行它时,它没有。
确切错误:访问 Cognito 内置登录页面后,重定向 URLhttps://...../api/auth/callback/cognito?code=......&state=.....显示 nginx 的默认 502 错误页面。
我检查过的内容:
是的,Callback URL(s)AWS Cognito 本身中的应用程序设置已设置为正确的 url ( https:// ....... /api/auth/callback/cognito)。
代码:
middleware.ts
export { default } from "next-auth/middleware";
export const config = { matcher: ["/dashboard/:path*"] };
Run Code Online (Sandbox Code Playgroud)
next.config.js
/** @type {import('next').NextConfig} */
const nextConfig = {
reactStrictMode: true,
swcMinify: true,
compiler: {
styledComponents: true, …Run Code Online (Sandbox Code Playgroud) 我正在尝试从Laravel 8中的Controller中的文本/纯 POST 请求获取内容/正文。
文档或大量谷歌搜索中的任何内容都不起作用。
$request->input();
$request->all();
$request->json();
json_encode($request);
Run Code Online (Sandbox Code Playgroud)
所有这些似乎都表明该请求完全是空的。
这可能与解决方案无关,但可能会帮助其他尝试搜索此问题的人:我尝试使用控制器处理的请求是由客户端的 navigator.sendBeacon 发送的。请求正文实际上是字符串化的 JSON,但 sendBeacon 不允许您使用内容类型 JSON 发送请求。开发工具将此请求的内容类型标头显示为“text/plain”。