Next.js Discord

Discord Forum

Azure Ad Login using next/auth returns 502 when attempting to login

Unanswered
posted this in #help-forum
Open in Discord
OP
I have Next.js project where i implement login for Azure AD using next/auth,
it works perfectly fine on localhost, when doing login, it got redirected back.
but when i use https and domain name, it returns 502 when done login. why?

4 Replies

OP
Okay found the fix thanks to my colleague
the 502 bad gateway error happens because of excessive buffer size (due to the long ass tokens)
so, by adding this configs on my nginx, it allows bigger buffer size which resulted in the error fixed
large_client_header_buffers 4 64k;
proxy_buffer_size 128k;
proxy_buffers 4 256k;
proxy_busy_buffers_size 256k