Put http to https redirect before SEO in Nginx virtualhost.
It makes better the compliance with HSTS, http to https redirect must be done before domain to www.domain for example. Nginx has SEO directives before https so the redirection is not done right.