mirror of
https://github.com/collinbarrett/FilterLists.git
synced 2026-03-11 09:04:27 +00:00
Revert "refactor(api): loosen CORS to allow CF edge cache"
This reverts commit ec1e006dc8.
This commit is contained in:
parent
d5a755f2ba
commit
9d87e1b1bc
1 changed files with 14 additions and 7 deletions
|
|
@ -4,11 +4,18 @@ namespace FilterLists.Directory.Api;
|
|||
|
||||
internal static class CorsConfiguration
|
||||
{
|
||||
internal static readonly Action<CorsOptions> SetupAction = options =>
|
||||
options.AddDefaultPolicy(policy =>
|
||||
policy
|
||||
.AllowAnyOrigin()
|
||||
.WithMethods("GET")
|
||||
.AllowAnyHeader()
|
||||
);
|
||||
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();
|
||||
});
|
||||
}
|
||||
Loading…
Reference in a new issue