set $test ""; if ($scheme = "http") { set $test "H"; } if ($request_uri = /.well-known/acme-challenge/test-challenge) { set $test "${test}T"; } if ($test = H) { return 301 https://$host$request_uri; }