Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
C
configuration
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
OpenEdx
configuration
Commits
2b049b40
Commit
2b049b40
authored
Jan 30, 2015
by
Feanil Patel
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1805 from edx/feanil/embargo_ability
Add the ability to embargo users based on CIDR blocks.
parents
ff1d298d
c92f3f81
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
31 additions
and
1 deletions
+31
-1
playbooks/roles/nginx/defaults/main.yml
+1
-0
playbooks/roles/nginx/templates/edx/app/nginx/sites-available/lms.j2
+30
-1
No files found.
playbooks/roles/nginx/defaults/main.yml
View file @
2b049b40
...
...
@@ -104,3 +104,4 @@ nginx_cfg:
version_json
:
"
{{
nginx_app_dir
}}/versions.json"
NGINX_ROBOT_RULES
:
[
]
NGINX_EDXAPP_EMBARGO_CIDRS
:
[]
playbooks/roles/nginx/templates/edx/app/nginx/sites-available/lms.j2
View file @
2b049b40
...
...
@@ -8,12 +8,29 @@ upstream lms-backend {
{% for host in nginx_lms_gunicorn_hosts %}
server {{ host }}:{{ edxapp_lms_gunicorn_port }} fail_timeout=0;
{% endfor %}
}
{%- if EDXAPP_ENABLE_RATE_LIMITING -%}
# Make Zone
limit_req_zone $cookie_{{ EDXAPP_SESSION_COOKIE_NAME }} zone=cookies:10m rate={{ EDXAPP_COURSES_REQUEST_RATE }};
{%- endif -%}
{%- endif %}
{% if NGINX_EDXAPP_EMBARGO_CIDRS %}
{%- if NGINX_SET_X_FORWARDED_HEADERS %}
geo $remote_addr $embargo {
{%- else %}
geo $http_x_forwarded_for $embargo {
{% endif -%}
default 0;
{% for cidr in NGINX_EDXAPP_EMBARGO_CIDRS -%}
{{ cidr }} 1;
{% endfor %}
}
{%- endif %}
server {
# LMS configuration file for nginx, templated by ansible
...
...
@@ -77,8 +94,20 @@ error_page {{ k }} {{ v }};
location / {
{% include "basic-auth.j2" %}
{% if NGINX_EDXAPP_EMBARGO_CIDRS -%}
if ( $embargo ) {
rewrite ^ /embargo;
}
{% endif -%}
try_files $uri @proxy_to_lms_app;
}
{% if NGINX_EDXAPP_EMBARGO_CIDRS %}
location /embargo {
try_files $uri @proxy_to_lms_app;
}
{% endif %}
# No basic auth for /segmentio/event
location /segmentio/event {
try_files $uri @proxy_to_lms_app;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment