diff --git a/Program.cs b/Program.cs index 62ac0bb..5532412 100644 --- a/Program.cs +++ b/Program.cs @@ -24,7 +24,7 @@ namespace GZTW.Pecklist .UseSetting("detailedErrors", "true") .UseKestrel() .UseContentRoot(System.IO.Directory.GetCurrentDirectory()) - .UseIISIntegration() + //.UseIISIntegration() .UseStartup() .Build(); } diff --git a/Startup.cs b/Startup.cs index d5ec55b..cba5ca9 100644 --- a/Startup.cs +++ b/Startup.cs @@ -4,6 +4,7 @@ using System.Linq; using System.Threading.Tasks; using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Hosting; +using Microsoft.AspNetCore.HttpOverrides; using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Logging; @@ -16,6 +17,7 @@ using Microsoft.AspNetCore.Authentication.JwtBearer; using Microsoft.IdentityModel.Tokens; using Microsoft.AspNetCore.Authentication; + namespace GZTW.Pecklist { public class Startup @@ -44,6 +46,8 @@ namespace GZTW.Pecklist services.AddMvc(); + + //get the key from the appsettings.json file var secretKey = Configuration.GetSection("JWT").GetValue("secret"); var signingKey = new SymmetricSecurityKey(System.Text.Encoding.ASCII.GetBytes(secretKey)); @@ -85,8 +89,14 @@ namespace GZTW.Pecklist loggerFactory.AddConsole(Configuration.GetSection("Logging")); loggerFactory.AddDebug(); + + app.UseForwardedHeaders(new ForwardedHeadersOptions + { + ForwardedHeaders = ForwardedHeaders.XForwardedFor | ForwardedHeaders.XForwardedProto + }); + app.UseDefaultFiles(); - app.UseStaticFiles(new StaticFileOptions + app.UseStaticFiles(new StaticFileOptions { OnPrepareResponse = context => { @@ -97,6 +107,7 @@ namespace GZTW.Pecklist } } }); + app.UseAuthentication(); app.UseMvc();