I got an Flask app in first container and NGINX on second, both hosted on the same server. On NGINX I want to have a proxy to first container, which have no ports exposed for reason that I want the NGINX to serve the app with HTTPS. My nginx.conf looks like this:
http {
server {
server_name hostname.domain;
listen 443 ssl;
ssl_certificate /hostname_domain.cer;
ssl_certificate_key /hostname_domain.key;
location / {
proxy_pass http://172.17.0.5:80; # Flask app container IP
}
}
}
The app is working fine, when I go to https://hostname.domain, but when I trigger Flask redirect method, like this:
return redirect(url_for("view.whatever"))
that should redirect me to https://hostname.domain/whatever, I am redirected to http://172.17.0.5/whatever. How to fix it and what is causing this behavior? Thanks for any answers!