Well, it works partially; sometimes (scarce cases) the redirect still uses http ... this happens even with: #if (NGX_HTTP_SSL) // if (c->ssl || port != 80) { *b->last++ ='s'; // } #endif Posted at Nginx Forum: https://forum.nginx.org/read.php?2,269623,269645#msg-269645