Skip to content

Commit

Permalink
Merge pull request #925 from neuroscout/gzip
Browse files Browse the repository at this point in the history
Gzip files, by serving w/ nginx not flask
  • Loading branch information
adelavega committed May 4, 2021
2 parents 284aea2 + 48e06f5 commit 5dbe14a
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 15 deletions.
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

0 comments on commit 5dbe14a

Please sign in to comment.