diff --git a/src/Identity.API/Controllers/HomeController.cs b/src/Identity.API/Controllers/HomeController.cs index c9cd6bc3e..e7e536b4d 100644 --- a/src/Identity.API/Controllers/HomeController.cs +++ b/src/Identity.API/Controllers/HomeController.cs @@ -4,8 +4,18 @@ namespace eShop.Identity.API.Controllers { [SecurityHeaders] [AllowAnonymous] - public class HomeController : Controller + public class HomeController(IWebHostEnvironment environment, ILogger logger) : Controller { - public IActionResult Index() => View(); + public IActionResult Index() + { + if (environment.IsDevelopment()) + { + // only show in development + return View(); + } + + logger.LogInformation("Homepage is disabled in production. Returning 404."); + return NotFound(); + } } }