summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJesse Plamondon-Willard <github@jplamondonw.com>2017-11-01 16:47:23 -0400
committerJesse Plamondon-Willard <github@jplamondonw.com>2017-11-01 16:47:23 -0400
commit8a2b779d0c59ab80ab6476ab28e838c69ab6c99a (patch)
treef5d81726accdba93acbc73cb51ebaeeac93e8c3b
parent5050a6d8ca14868863dfcd1f8564b51cf63825d4 (diff)
downloadSMAPI-8a2b779d0c59ab80ab6476ab28e838c69ab6c99a.tar.gz
SMAPI-8a2b779d0c59ab80ab6476ab28e838c69ab6c99a.tar.bz2
SMAPI-8a2b779d0c59ab80ab6476ab28e838c69ab6c99a.zip
add CORS policy for *.smapi.io (#358)
-rw-r--r--src/SMAPI.Web/Startup.cs6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/SMAPI.Web/Startup.cs b/src/SMAPI.Web/Startup.cs
index bc491128..0ea9f7ee 100644
--- a/src/SMAPI.Web/Startup.cs
+++ b/src/SMAPI.Web/Startup.cs
@@ -64,6 +64,12 @@ namespace StardewModdingAPI.Web
loggerFactory.AddConsole(this.Configuration.GetSection("Logging"));
loggerFactory.AddDebug();
app
+ .UseCors(policy => policy
+ .AllowAnyHeader()
+ .AllowAnyMethod()
+ .WithOrigins("https://smapi.io", "https://*.smapi.io", "https://*.edge.smapi.io")
+ .SetIsOriginAllowedToAllowWildcardSubdomains()
+ )
.UseRewriter(new RewriteOptions()
// redirect to HTTPS (except API for Linux/Mac Mono compatibility)
.Add(new ConditionalRedirectToHttpsRule(