28 Adding HTTPS to an application

 

This chapter covers

  • Encrypting traffic between clients and your app using HTTPS
  • Using the HTTPS development certificate for local development
  • Configuring Kestrel with a custom HTTPS certificate
  • Enforcing HTTPS for your whole app

Web application security is a hot topic at the moment. Practically every week another breach is reported, or confidential details are leaked. It may seem like the situation is hopeless, but the reality is that the vast majority of breaches could have been prevented with the smallest amount of effort.

In chapter 29 we’ll look at a range of common attacks and how to protect against them in your ASP.NET Core app. In this chapter we start by looking at one of the most basic security measures: encrypting the traffic between a client such as a browser and your application.

Without HTTPS encryption, you risk third parties spying on or modifying the requests and responses as they travel over the internet. The risks associated with unencrypted traffic mean that HTTPS is effectively mandatory for production apps these days, and it is heavily encouraged by the makers of modern browsers such as Chrome and Firefox. In section 28.1 you’ll learn more about these risks and some of the approaches you can take to protect your application.

28.1 Why do I need HTTPS?

28.2 Using the ASP.NET Core HTTPS development certificates

28.3 Configuring Kestrel with a production HTTPS certificate

28.4 Enforcing HTTPS for your whole app

28.4.1 Enforcing HTTPS with HTTP Strict Transport Security headers

28.4.2 Redirecting from HTTP to HTTPS with HTTPS redirection middleware

28.4.3 Rejecting HTTP requests in API applications

Summary

sitemap