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

Gzip files, by serving w/ nginx not flask #925

Merged
merged 1 commit into from
May 4, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
7 changes: 0 additions & 7 deletions neuroscout/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,10 +85,3 @@ def confirm(token):
return render_template(
'confirm.html', confirmed=confirmed, expired=expired, invalid=invalid,
name=name, action_url=url_for('index', _external=True))


@app.route('/', defaults={'path': ''})
@app.route('/<path:path>')
def index(path):
''' Serve index '''
return send_file("frontend/build/index.html")
20 changes: 12 additions & 8 deletions nginx/nginx.conf
Original file line number Diff line number Diff line change
Expand Up @@ -44,18 +44,17 @@ http {
gzip_proxied any;
gzip_comp_level 6;
gzip_buffers 16 8k;
gzip_http_version 1.1;
gzip_types text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript;
gzip_types text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript application/javascript;


server {
server_name _;
root /neuroscout/neuroscout/frontend/build;

location /static/ {
}

location /analyses {
location /static {
}
location /analyses {
alias /file-data/analyses;
}

Expand All @@ -78,8 +77,13 @@ http {
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}

location / {
proxy_pass http://neuroscout:8000;
location = / {
root /neuroscout/neuroscout/frontend/build;
try_files /index.html =404;
}

location ^~ / {
proxy_pass http://neuroscout:8000/;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
Expand Down