mirror of
https://github.com/collinbarrett/FilterLists.git
synced 2026-03-11 09:04:27 +00:00
refactor(api): loosen CORS to allow CF edge cache
This commit is contained in:
parent
3865616802
commit
ec1e006dc8
1 changed files with 7 additions and 14 deletions
|
|
@ -4,18 +4,11 @@ namespace FilterLists.Directory.Api;
|
|||
|
||||
internal static class CorsConfiguration
|
||||
{
|
||||
private const string ProductionClientOrigin = "https://filterlists.com";
|
||||
private const string StagingClientOriginStart = "https://nice-water-05873140f";
|
||||
private const string StagingClientOriginEnd = ".eastus2.5.azurestaticapps.net";
|
||||
private const string LocalClientOrigin = "http://localhost:3000";
|
||||
|
||||
internal static readonly Action<CorsOptions> SetupAction = options => options.AddDefaultPolicy(policy =>
|
||||
{
|
||||
policy.SetIsOriginAllowed(origin =>
|
||||
origin is ProductionClientOrigin or LocalClientOrigin ||
|
||||
(origin.StartsWith(StagingClientOriginStart, StringComparison.InvariantCulture) &&
|
||||
origin.EndsWith(StagingClientOriginEnd, StringComparison.InvariantCulture)))
|
||||
.WithMethods("GET")
|
||||
.AllowAnyHeader();
|
||||
});
|
||||
internal static readonly Action<CorsOptions> SetupAction = options =>
|
||||
options.AddDefaultPolicy(policy =>
|
||||
policy
|
||||
.AllowAnyOrigin()
|
||||
.WithMethods("GET")
|
||||
.AllowAnyHeader()
|
||||
);
|
||||
}
|
||||
Loading…
Reference in a new issue