Login issues(Redirection Loop) after setting up Studio on sub domain

That occurs because when you log in from the LMS, it sets a cookie. then redirects you to CMS. but CMS doesn’t have access to that cookie and can’t understand the true state of your login. So redirects you back to LMS. this time LMS knows who you are so immediately redirects you to CMS and so on…

Simply set this on lms.env.json and cms.env.json files:

SESSION_COOKIE_DOMAIN: ".mydomain.org"

Note: The dot at the beginning of .mydomain.org is mandatory

EDIT: As @Sandesh_Yadav mentioned below, since the Juniper release, changes have to be applied into /edx/etc/lms.yml and /edx/etc/studio.yml instead of deprecated JSON files to be considered.