Enable Basic Auth for some (or all) endpoints

See the docs

Redirect all http traffic to https

Add following to the server block of the nginx configuration.

return 301 https://$server_name$request_uri;

In case you want only a few endpoints to redirect to https, rather than all the
traffic, you need to create two server blocks. One for http and other for

location block under each determines which endpoint redirects to https.

See this SO answer