Skip to content

Commit fdb83ae

Browse files
committed
Extracted scheme and host for Moodle base url
1 parent 0a3adef commit fdb83ae

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

LearningHub.Nhs.WebUI/Program.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,12 +36,14 @@
3636
builder.Host.UseNLog();
3737

3838
string corsMoodleUrl = builder.Configuration.GetValue<string>("MoodleAPIConfig:BaseUrl");
39+
Uri moodleUri = new Uri(corsMoodleUrl);
40+
string moodleBaseUrl = $"{moodleUri.Scheme}://{moodleUri.Host}";
3941

4042
builder.Services.AddCors(options =>
4143
{
4244
options.AddPolicy("MoodleCORS", builder =>
4345
{
44-
builder.WithOrigins(corsMoodleUrl)
46+
builder.WithOrigins(moodleBaseUrl)
4547
.AllowAnyHeader()
4648
.AllowAnyMethod()
4749
.AllowCredentials();

0 commit comments

Comments
 (0)