Issue with redirect to HTTP on 'Sign in' in Studio

Hello,
I deploy Tutor (olive.1) in Kubernetes. I build the project with HTTPS enabled globally (The argument “ENABLE_HTTPS: true” is defined in the global configuration file ~/.local/share/tutor/config.yml). In general I’ve no issues with using HTTPS in the project except authentication in Studio.
For example if I go to the studio url “https://studio.lms.mysite.com” and click on the “Sign in” button it sends me to the url “https://studio.lms.mysite.com/login/?next=http://studio.lms.mysite.com/”. As you can see it redirects me to HTTP instead of HTTPS in the “next=”.
Can you please help me to fix this problem? I tried to rebuild the project again with “ENABLE_HTTPS: true”. I checked there’re no references to “http://” in the ~/.local/share/tutor/env/apps/openedx/settings/cms/production.py, ~/.local/share/tutor/env/apps/openedx/settings/lms/production.py files.

1 Like

[Update] Please see the below alternative solution

Unrecommend solution I had encountred same issue to resolve, I just went to admin setting the changs the redirct url of cms-sso.
  1. got to yourlms.com/admin/oauth2_provider/application/
  2. choose cms-sso from the list
  3. change Redirect uris scheme from https to http
  4. save, and try to login from studio again.

My vauge understanding of why this is happening:
It that when you are try to access to studio, django would still thinks your using http when it gets requst.path which is used probably to create session/token. So it sets redirect-url/next with http though tutor when created the django-dot-application used https.

</End of Unrecommend solutoin>

[Edit/Update]:

Alternative and better solution:

Make sure your proxy server set these header, in my the case I use, nginx and the following were essetinals

      proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
      proxy_set_header X-Forwarded-Proto https;

  • Set the following headers appropriately: X-Forwarded-Proto, X-Forwarded-Port.

ref

1 Like