Zitat (Shiro Tamoto (tamoto))[...]
proxy_set_header X-Forwarded-Proto $http_x_forwarded_proto;
The variable $http_x_forwarded_proto only contains a value when the original request already came with a header X-Forwarded-Proto (unlikely). What you probably want to do is use the $scheme variable:
proxy_set_header X-Forwarded-Proto $scheme;