Initial commit - ECommerce project
This commit is contained in:
Executable
+47
@@ -0,0 +1,47 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Commerce.Config;
|
||||
|
||||
public static class Cors
|
||||
{
|
||||
public static IServiceCollection AddCustomCors(this IServiceCollection services)
|
||||
{
|
||||
services.AddCors(options =>
|
||||
{
|
||||
options.AddDefaultPolicy(builder =>
|
||||
{
|
||||
builder
|
||||
.AllowAnyOrigin()
|
||||
.AllowAnyHeader()
|
||||
.AllowAnyMethod()
|
||||
.WithExposedHeaders("X-Pagination"); // This line!
|
||||
|
||||
// .AllowCredentials()
|
||||
// .SetIsOriginAllowedToAllowWildcardSubdomains() // For SameSite=None
|
||||
// .WithExposedHeaders("*");
|
||||
});
|
||||
|
||||
options.AddPolicy(
|
||||
"default",
|
||||
builder =>
|
||||
{
|
||||
builder
|
||||
.AllowAnyOrigin()
|
||||
.AllowAnyHeader()
|
||||
.AllowAnyMethod()
|
||||
.WithExposedHeaders("X-Pagination"); // This line!
|
||||
|
||||
// .AllowCredentials()
|
||||
// .SetIsOriginAllowedToAllowWildcardSubdomains() // For SameSite=None
|
||||
// .WithExposedHeaders("*");
|
||||
}
|
||||
);
|
||||
});
|
||||
|
||||
return services;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user