nativeInstalleredx

Force HTTPS redirection with Apache

Before running the commands shown on this page, you should load the Bitnami stack environment by executing the installdir/use_APPNAME script (Linux and Mac OS X) or by clicking the shortcut in the Start Menu under “Start -> Bitnami APPNAME Stack -> Application console” (Windows). Learn more.

Edit the configuration file installdir/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]

If you installed the stack as the root user, 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]

If you didn’t install the stack as the root user, redirect to the port 8443:

# 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}:8443/$1 [R,L]

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

Last modification October 1, 2018