From 176a81e05551c7643f180fab02ce2c793b737e8d Mon Sep 17 00:00:00 2001 From: chylex Date: Fri, 15 Jul 2022 01:25:49 +0200 Subject: [PATCH] Reformat list of allowed origins in CORS --- app/Server/Service/ServerStartup.cs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/app/Server/Service/ServerStartup.cs b/app/Server/Service/ServerStartup.cs index 9ba1172..3a1b1f2 100644 --- a/app/Server/Service/ServerStartup.cs +++ b/app/Server/Service/ServerStartup.cs @@ -9,6 +9,13 @@ using Microsoft.Extensions.Hosting; namespace DHT.Server.Service { sealed class Startup { + private static readonly string[] AllowedOrigins = { + "https://discord.com", + "https://ptb.discord.com", + "https://canary.discord.com", + "https://discordapp.com" + }; + public void ConfigureServices(IServiceCollection services) { services.Configure(static options => { options.SerializerOptions.NumberHandling = JsonNumberHandling.Strict; @@ -16,7 +23,7 @@ namespace DHT.Server.Service { services.AddCors(static cors => { cors.AddDefaultPolicy(static builder => { - builder.WithOrigins("https://discord.com", "https://discordapp.com", "https://ptb.discord.com", "https://canary.discord.com").AllowCredentials().AllowAnyMethod().AllowAnyHeader(); + builder.WithOrigins(AllowedOrigins).AllowCredentials().AllowAnyMethod().AllowAnyHeader(); }); }); }