Esempio n. 1
0
        /// <summary>The method called by the runtime to configure the HTTP request pipeline.</summary>
        /// <param name="app">The application builder.</param>
        /// <param name="env">The hosting environment.</param>
        public void Configure(IApplicationBuilder app, IHostingEnvironment env)
        {
            // basic config
            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
            }
            app
            .UseCors(policy => policy
                     .AllowAnyHeader()
                     .AllowAnyMethod()
                     .WithOrigins("https://smapi.io", "https://*.smapi.io", "https://*.edge.smapi.io")
                     .SetIsOriginAllowedToAllowWildcardSubdomains()
                     )
            .UseRewriter(this.GetRedirectRules())
            .UseStaticFiles()     // wwwroot folder
            .UseMvc();

            // enable Hangfire dashboard
            app.UseHangfireDashboard("/tasks", new DashboardOptions
            {
                IsReadOnlyFunc = context => !JobDashboardAuthorizationFilter.IsLocalRequest(context),
                Authorization  = new[] { new JobDashboardAuthorizationFilter() }
            });
        }
Esempio n. 2
0
        /// <summary>The method called by the runtime to configure the HTTP request pipeline.</summary>
        /// <param name="app">The application builder.</param>
        public void Configure(IApplicationBuilder app)
        {
            // basic config
            app.UseDeveloperExceptionPage();
            app
            .UseCors(policy => policy
                     .AllowAnyHeader()
                     .AllowAnyMethod()
                     .WithOrigins("https://smapi.io")
                     )
            .UseRewriter(this.GetRedirectRules())
            .UseStaticFiles()     // wwwroot folder
            .UseRouting()
            .UseAuthorization()
            .UseEndpoints(p =>
            {
                p.MapControllers();
                p.MapRazorPages();
            });

            // enable Hangfire dashboard
            app.UseHangfireDashboard("/tasks", new DashboardOptions
            {
                IsReadOnlyFunc = context => !JobDashboardAuthorizationFilter.IsLocalRequest(context),
                Authorization  = new[] { new JobDashboardAuthorizationFilter() }
            });
        }