azureedx

Force HTTPS redirection with Apache

Edit the configuration file /opt/bitnami/apps/edx/conf/httpd-lms.conf and find the lines containing rewrite rules. Typically, it will look like this:

# Enable some basic redirections
RewriteEngine On
RewriteRule ^/edx-studio(/.*)? http://%{SERVER_NAME}:18010/ [R,L]

Update the above content with additional rules to force HTTPS redirection, so that it looks like this:

# Enable some basic redirections
RewriteEngine On
RewriteRule ^/edx-studio(/.*)? http://%{SERVER_NAME}:18010/ [R,L]
# Force HTTPS redirection
RewriteCond %{HTTPS} !=on
RewriteRule ^/(.*) https://%{SERVER_NAME}/$1 [R,L]

After modifying the Apache configuration files, restart Apache to apply the changes.