BB-729 Add variable to add custom Nginx rules.


  • [ ] A DevOps team member has approved the PR if it is code shared across multiple services and you don't own all of the services.

  • [ ] Are you adding any new default values that need to be overridden when this change goes live? If so:

  • [ ] Update the appropriate internal repo (be sure to update for all our environments)

  • [ ] If you are updating a secure value rather than an internal one, file a DEVOPS ticket with details.

  • [ ] Add an entry to the CHANGELOG.

  • [ ] If you are making a complicated change, have you performed the proper testing specified on the [Ops Ansible Testing Checklist]( Adding a new variable does not require the full list (although testing on a sandbox is a great idea to ensure it links with your downstream code changes).

This PR introduces two new optional variables `NGINX_EDXAPP_LMS_EXTRA` and `NGINX_EDXAPP_CMS_EXTRA`. The idea is to use these variables in case there's any extra custom configuration needed for nginx.
Our main use for this are clients who have other services running to manage their main site (e.g. wordpress) and they want specific redirects for the top domain. For instance, the site ** wants every user to land on their wordpress site (**) instead of the default lms landing view. This can be managed through [edx-django-sites-extensions]( redirect app. The issue with this redirect app is that it will apply the redirect for the entire domain and since studio and lms share the same database then the previously described redirect applies for both lms' root and studio root. We end up with a redirect when a user goes to either ** or ** to the wordpress site.
By adding this new variables we can add an nginx rule such as
location = / {
redirect 301 https://$hostname/school;
That will only apply for lms (or cms if needed) and will not conflict with other subsites (e.g. studio).
The variables are optional in the case that they are not defined the jinja template will not print anything. This way we do not break previously provisioned instances.




Open Source Pull Request Bot

Contributor Name

Josue Balandrano Coronel




Epic Link


OSCM Assignee


Platform Map Area (Levels 1 & 2)

Site Delivery & Infrastructure

Platform Map Area (Levels 3 & 4)