How can I enforce SSL using ASP.NET Core and nginx How can I enforce SSL using ASP.NET Core and nginx nginx nginx

How can I enforce SSL using ASP.NET Core and nginx


Your SSL connection is terminated as nginx, which communicates with Kestrel in plain http. Kestrel redirects user to https, which is terminated again in nginx, passed to Kestrel as http and again and again. That's endless loop.

Configure nginx to require https (redirect http to https), don't touch Kestrel. You site itself will always work without SSL, and nginx will deliver it to users (and back) using SSL.