Subfolder SSO Login redirection issue

Hi, I have deployed discourse on vm, and configured sso, Also have configured application gateway, we have set a path rule /community for forum, on hitting /community/session/sso the app authorises and redirects back to the main website.
For example: on hitting i am automatically redirected back to
When i check the log it has authorised token but at the end it is redirecting to main site.

Could anyone please help me with this issue