Assistance Needed with Configuring ALLOWED_HOSTS in Open edX on Kubernetes

Hello Open edX Community,

I am currently running an Open edX platform on a Kubernetes cluster, and I’m encountering a DisallowedHost error related to the ALLOWED_HOSTS setting in Django. I need assistance in properly configuring the ALLOWED_HOSTS for both the LMS and CMS instances.

### Details of My Setup:

  • Kubernetes Environment: AKS
  • Current Configuration Files:
    • LMS Production Settings: /home/ubuntu/tutor/tutor/templates/apps/openedx/settings/lms/production.py
    • CMS Production Settings: /home/ubuntu/tutor/tutor/templates/apps/openedx/settings/cms/production.py
  • Error Message:
Invalid HTTP_HOST header: '4.182.6.196'. You may need to add '4.182.6.196' to ALLOWED_HOSTS.

Steps Taken:

  1. Modified the ALLOWED_HOSTS list in both LMS and CMS production files to include my IP address (4.182.6.196).
  2. Restarted the pods after making the changes.
  3. Still encountering the DisallowedHost error upon accessing the LMS.

Questions:

  1. Are there additional configurations I need to be aware of within the Open edX or Kubernetes environment that might affect the ALLOWED_HOSTS setting?
  2. Could there be any caching issues or additional steps I might have missed when applying these changes?
  3. How can I verify that the settings are correctly applied after making changes?

Any guidance or troubleshooting tips would be greatly appreciated. Thank you in advance for your assistance!

Hi @Med_amine_Boujelbene,
Maybe you have already fixed this. You shouldn’t need to change any setting directly in the production files. ALLOWED_HOSTS should be managed by Tutor, even in K8s deployments. Btw, you should use DNS instead of IP addresses to connect. Maybe that’s the problem.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.