ASP.NET Core Web API Interview Question #71

What is HTTPS and why is it essential for APIs?

Authentication, Authorization, JWT & API Security Mid-Level Intermediate

Quick Interview Answer

HTTPS uses TLS to protect HTTP traffic against passive reading and tampering while in transit and to authenticate the server according to the certificate trust model. Credentials, bearer tokens, cookies, and application data should not travel over unprotected HTTP on untrusted networks.

Detailed Explanation

HTTPS uses TLS to protect HTTP traffic against passive reading and tampering while in transit and to authenticate the server according to the certificate trust model. Credentials, bearer tokens, cookies, and application data should not travel over unprotected HTTP on untrusted networks.

Production APIs should use HTTPS consistently and configure proxy or load-balancer termination correctly when TLS ends before the ASP.NET Core process.

Code Example

app.UseHttpsRedirection();

// Production infrastructure should also
// serve the public API through HTTPS/TLS.