Fix Auth.js server error behind reverse proxy
Add trustHost: true to NextAuth config so Auth.js accepts requests when running behind Traefik/reverse proxy. Without this, Auth.js rejects the credential callback because the forwarded host doesn't match its expectations. Made-with: Cursor
This commit is contained in:
parent
95a672a6cb
commit
04e9811572
2 changed files with 3 additions and 0 deletions
|
|
@ -19,6 +19,8 @@ WATCH_DIR=""
|
|||
|
||||
# Auth.js (required — generate with: npx auth secret)
|
||||
AUTH_SECRET=""
|
||||
# Set AUTH_URL to your external URL when behind a reverse proxy
|
||||
AUTH_URL="https://staging.echoocr.stillwell.cloud"
|
||||
|
||||
# Authentik OIDC SSO (optional — enables "Sign in with SSO" button)
|
||||
# Create an OAuth2/OIDC provider in Authentik and set these values.
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@ import { prisma } from "@/lib/db";
|
|||
export const { handlers, auth, signIn, signOut } = NextAuth({
|
||||
adapter: PrismaAdapter(prisma),
|
||||
session: { strategy: "jwt" },
|
||||
trustHost: true,
|
||||
pages: {
|
||||
signIn: "/login",
|
||||
},
|
||||
|
|
|
|||
Loading…
Reference in a new issue