Esempio n. 1
0
        public void PreConfigure(IAppHost appHost)
        {
            var debug = appHost.AppSettings.Get("debug", appHost.GetHostingEnvironment().IsDevelopment());

            appHost.Plugins.Add(new SharpPagesFeature {
                EnableSpaFallback = true,
                // Args = { ["connect"] = "https://localhost:5001" } //test ?connect={url} import scheme
            });

            var sites = StudioServices.LoadAppSettings();

            appHost.Plugins.Add(new DesktopFeature {
                AccessRole = debug
                    ? RoleNames.AllowAnon
                    : RoleNames.Admin,
                ImportParams =
                {
                    "debug",
                    "connect",
                },
                ProxyConfigs = sites.Keys.Map(baseUrl => new Uri(baseUrl))
                               .Map(uri => new ProxyConfig {
                    Scheme        = uri.Scheme,
                    TargetScheme  = uri.Scheme,
                    Domain        = uri.Host,
                    AllowCors     = true,
                    IgnoreHeaders = { "X-Frame-Options", "Content-Security-Policy" },
                })
            });
        }