This is my first attempt to deploy a plotly dash python web app. I followed below tutorials to get going
- digital ocean flask app with gunicorn and nginx
- Okta authentication for flask app using OpenIdConnect
The app runs fine on an ec2 instance with nginx and gunicorn all in docker containers. The redirect to okta for authentication and back works fine (using ec2 instance public ip)
After setting redirect for domain name via aws load balancer (HTTPS) it started failing complaining 404 as url scheme returned was http instead of https.
First i added OVERWRITE_REDIRECT_URI
config with https which fixed incorrect redirect uri problem on okta side
Then tried ProxyFix
and all options in below SO posts but after redirect to /authorization-code/callback?code=<long code value>, the response always comes back with http://<my_website_name>/<page> instead of https
- Make Flask's url_for use the 'https' scheme in an AWS load balancer without messing with SSLify
- X-Forwarded-Proto and Flask
I'm stuck at this point, what am i missing here?
Thanks
nginx conf.d/conf
upstream app_server {
server dash:8050;
}
server {
listen 80;
server_name _;
location / {
try_files $uri @proxy_to_app;
}
location @proxy_to_app {
gzip_static on;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header Host $http_host;
proxy_buffering off;
proxy_redirect off;
proxy_pass http://app_server;
}
}