Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Brotli Compression Not Working with Piranha CMS #2071

Open
vitali-karmanov opened this issue May 29, 2024 · 2 comments
Open

Brotli Compression Not Working with Piranha CMS #2071

vitali-karmanov opened this issue May 29, 2024 · 2 comments
Labels

Comments

@vitali-karmanov
Copy link
Contributor

Hello everyone,

Following Microsoft's documentation to enable Brotli compression doesn't seem to work with Piranha CMS. The Content-Encoding header is missing in the response.

image

I wonder if this might be related to issue #1899.

Here is my Program.cs file.

var builder = WebApplication.CreateBuilder(args);

// Enable response compression
builder.Services.AddResponseCompression(options =>
{
options.EnableForHttps = true;
});

builder.AddPiranha(options =>
{
options.AddRazorRuntimeCompilation = true;

options.UseCms();
options.UseManager();

options.UseFileStorage(naming: Piranha.Local.FileStorageNaming.UniqueFolderNames);
options.UseImageSharp();
options.UseTinyMCE();
options.UseMemoryCache();

var connectionString = builder.Configuration.GetConnectionString("piranha");
options.UseEF<SQLServerDb>(db => db.UseSqlServer(connectionString));
options.UseIdentityWithSeed<IdentitySQLServerDb>(db => db.UseSqlServer(connectionString));

options.Services.AddLogging();

});

var app = builder.Build();

// Use response compression middleware
app.UseResponseCompression();

app.UseRouting();

if (app.Environment.IsDevelopment())
{
app.UseDeveloperExceptionPage();
}

app.UsePiranha(options =>
{
// Initialize Piranha
App.Init(options.Api);

// Build content types
new ContentTypeBuilder(options.Api)
    .AddAssembly(typeof(Program).Assembly)
    .Build()
    .DeleteOrphans();

// Configure Tiny MCE
EditorConfig.FromFile("editorconfig.json");

options.UseManager();
options.UseTinyMCE();
options.UseIdentity();

});

app.Run();

Any guidance or suggestions to resolve this issue would be greatly appreciated.

Thank you!

@tidyui
Copy link
Member

tidyui commented Jun 11, 2024

The ASP.NET client sdk tools in Piranha is basically just middleware redirecting to ASP.NET, and then it's up to the rendering to do its magic any way it sees fit. In that sense it's strange that Piranha would disable any headers that should be outputted.

@tidyui
Copy link
Member

tidyui commented Jun 11, 2024

And issue #1899 is regarding adding custom options to the asp.net static file middleware that wasn't added by Piranha by default. This however seems to be more in regards to output compression of the generated HTML. Have you verified that the client is sending the correct Accept-Encoding header to the server?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants