Discourse Connect not redirecting to my website

Configured everything for sso, works perfectly fine with local production environment.
After deployed with nginx, on login button click it redirects to current_url/session/sso?return_path=%2F
Sometimes it redirects with sso and sig but most of the time not. Anyone faced the same?