fix(server): fixes preflight CORS issue
This commit is contained in:
@@ -159,6 +159,8 @@ var managementStore = app.Services.GetRequiredService<ManagementStore>();
|
|||||||
var tunnelHub = app.Services.GetRequiredService<TunnelHub>();
|
var tunnelHub = app.Services.GetRequiredService<TunnelHub>();
|
||||||
managementStore.SetConnectedClientProvider(() => tunnelHub.ClientSnapshots.Select(c => c.Id));
|
managementStore.SetConnectedClientProvider(() => tunnelHub.ClientSnapshots.Select(c => c.Id));
|
||||||
|
|
||||||
|
app.UseCors();
|
||||||
|
|
||||||
if (settings.Keycloak.IsConfigured)
|
if (settings.Keycloak.IsConfigured)
|
||||||
{
|
{
|
||||||
app.UseAuthentication();
|
app.UseAuthentication();
|
||||||
@@ -179,8 +181,6 @@ app.UseAntiforgery();
|
|||||||
|
|
||||||
app.UseElmah();
|
app.UseElmah();
|
||||||
|
|
||||||
app.UseCors();
|
|
||||||
|
|
||||||
app.Use(async (context, next) =>
|
app.Use(async (context, next) =>
|
||||||
{
|
{
|
||||||
context.Response.Headers.XFrameOptions = "DENY";
|
context.Response.Headers.XFrameOptions = "DENY";
|
||||||
|
|||||||
@@ -94,6 +94,13 @@ internal sealed class ServerSettings
|
|||||||
|
|
||||||
private static string[] ReadStringArray(IConfiguration configuration, params string[] keys)
|
private static string[] ReadStringArray(IConfiguration configuration, params string[] keys)
|
||||||
{
|
{
|
||||||
|
var section = configuration.GetSection(keys[0]);
|
||||||
|
var children = section.GetChildren().ToList();
|
||||||
|
if (children.Count > 0)
|
||||||
|
{
|
||||||
|
return children.Select(c => c.Value!).Where(v => !string.IsNullOrWhiteSpace(v)).ToArray();
|
||||||
|
}
|
||||||
|
|
||||||
var value = Read(configuration, keys);
|
var value = Read(configuration, keys);
|
||||||
if (string.IsNullOrWhiteSpace(value))
|
if (string.IsNullOrWhiteSpace(value))
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user