Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Explicitly configure nginx proxy settings #4564

Merged
merged 1 commit into from
May 16, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 13 additions & 34 deletions deploy/nginx.conf.jinja2
Original file line number Diff line number Diff line change
Expand Up @@ -19,41 +19,11 @@ http {
text/javascript
application/x-javascript
application/atom+xml;

# Proxy upstream to the gunicorn process
upstream studio {
server 127.0.0.1:8081;
}

# Allow-list filter for content catalog paths
server {
listen 8080;
server_name catalog.learningequality.org;
location = / {
proxy_pass http://studio;
proxy_redirect off;
proxy_set_header Host $host;
}
location /static/ {
autoindex on;
alias /app/contentworkshop_static/;
expires 4h;
}
location /content/ {
proxy_http_version 1.1;
proxy_pass {{ $aws_s3_endpoint_url }}/{{ $aws_s3_bucket_name }}/;
proxy_set_header Host $proxy_host;
proxy_set_header Accept-Encoding Identity;
proxy_redirect off;
gzip off;
}
location ~ ^/(api/catalog|stealthz|healthz|api/get_channel_details|jsreverse|i18n) {
proxy_pass http://studio;
proxy_redirect off;
proxy_set_header Host $host;
}
location / {
deny all;
}
keepalive 5;
}

# Configuration for Nginx
Expand All @@ -80,17 +50,26 @@ http {
# Proxy connections to django
location / {
proxy_pass http://studio;
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_read_timeout 100s;
proxy_redirect off;
proxy_cache off;
}

location /content/ {
limit_except GET HEAD OPTIONS {
deny all;
}
proxy_http_version 1.1;
proxy_pass {{ $aws_s3_endpoint_url }}/{{ $aws_s3_bucket_name }}/;
proxy_set_header Host $proxy_host;
proxy_set_header Host $host;
proxy_set_header Accept-Encoding Identity;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_redirect off;
proxy_buffering off;
proxy_cache off;
proxy_read_timeout 100s;
gzip off;
}

Expand Down