python - How do you get Gunicorn + Flask to serve static files over https? -
i using gunicorn + flask + python develop heroku app, , want able run locally foreman. works fine, when switch use ssl site, no longer able find javascript files under /static. how can make these available under https?
can use nginx front-end gunicorn? if can serve static content javascript via ssl adding location block below nginx.conf:
server { listen 443 ssl; # other normal ssl stuff seem have working location / { root /path/to/your/static/stuff; try_files $uri /index.html; # match static content } location /api { # normal proxy stuff gunicorn } }
and separately, can serve static content separate api on http efficiency, below:
server { listen 80; location / { try_files $uri /index.html; } } server { listen 443 ssl; # other normal ssl stuff seem have working location /api { # normal proxy stuff gunicorn } }
Comments
Post a Comment