Skip to content

Commit

Permalink
Add Brotli compression and enable for HTTPS
Browse files Browse the repository at this point in the history
  • Loading branch information
jpsingleton committed Jan 4, 2022
1 parent bbef9d9 commit 09d86df
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions Huxley2/Startup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,12 @@ public Startup(IConfiguration config)

public static void ConfigureServices(IServiceCollection services)
{
// Shouldn't be a security issue as plaintext isn't chosen by the user and we aren't using auth or sessions
// https://docs.microsoft.com/en-us/aspnet/core/performance/response-compression?view=aspnetcore-6.0#compression-with-secure-protocol
services.AddResponseCompression(options =>
{
options.EnableForHttps = true;
});
// AddResponseCaching doesn't appear to add any more services but best to be explicit for the future
services.AddResponseCaching();
services.AddControllers();
Expand Down Expand Up @@ -65,6 +71,7 @@ public async void Configure(
{
logger.LogInformation("Configuring Huxley 2 web API application");

app.UseResponseCompression();
if (env.IsDevelopment())
{
app.UseDeveloperExceptionPage();
Expand Down

0 comments on commit 09d86df

Please sign in to comment.