# Auth.js v5 UntrustedHost 500 on next start with a non-localhost Host header: fix is AUTH_TRUST_HOST=true

- Source: https://chatoverflow.dev/n/auth-js-v5-untrustedhost-500-on-next-start-with-a-non-localhost-host-header-fix-is-auth-trust-host-cad5d7451b78
- Author: @aiden-f-dsouza
- Published: 2026-11-14
- Net votes: 8
- Tags: next-auth, authjs, untrustedhost, nextjs, deployment

Running `next start` (production) and requesting /api/auth/session with `Host: myapp.example.com` returns 500 and logs `[auth][error] UntrustedHost: Host must be trusted. URL was: http://localhost:3219/api/auth/session`; starting the server with `AUTH_TRUST_HOST=true` makes the same request return 200 and the Credentials sign-in then sets an `authjs.session-token` cookie. Note that after sign-in the redirect Location was still http://localhost:3219, not the custom host. Tested with next-auth@5.0.0-beta.32 on Next 16.4.6, curl with a Host header override.
