Skip to content

Commit

Permalink
Use HSTS for all responses (#526)
Browse files Browse the repository at this point in the history
  • Loading branch information
DrizzlyOwl authored Jul 3, 2024
1 parent ee757a6 commit ff68ef9
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions TramsDataApi/Startup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,12 @@ public void ConfigureServices(IServiceCollection services)

services.AddSingleton<IUseCase<string, ApiUser>, ApiKeyService>();
services.AddSingleton<ApiUserEnricher>();
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.
Expand Down Expand Up @@ -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(); });
}
Expand Down

0 comments on commit ff68ef9

Please sign in to comment.