diff --git a/TramsDataApi/Startup.cs b/TramsDataApi/Startup.cs index 694a19fb3..88957b583 100644 --- a/TramsDataApi/Startup.cs +++ b/TramsDataApi/Startup.cs @@ -111,6 +111,12 @@ public void ConfigureServices(IServiceCollection services) services.AddSingleton, ApiKeyService>(); services.AddSingleton(); + services.AddHsts(options => + { + options.Preload = true; + options.IncludeSubDomains = true; + options.MaxAge = TimeSpan.FromDays(365); + }); } // This method gets called by the runtime. Use this method to configure the HTTP request pipeline. @@ -169,6 +175,7 @@ public void Configure(IApplicationBuilder app, IWebHostEnvironment env, IApiVers app.UseHttpsRedirection(); app.UseRouting(); app.UseAuthorization(); + app.UseHsts(); app.UseEndpoints(endpoints => { endpoints.MapControllers(); }); }