Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion dotnet/src/dotnetcore/GxNetCoreStartup/Startup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Http.Features;
using Microsoft.AspNetCore.HttpOverrides;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.ApplicationModels;
using Microsoft.AspNetCore.Mvc.ModelBinding;
Expand Down Expand Up @@ -259,7 +260,10 @@ public void ConfigureServices(IServiceCollection services)
{
options.IdleTimeout = TimeSpan.FromMinutes(Preferences.SessionTimeout);
options.Cookie.HttpOnly = true;
options.Cookie.SecurePolicy = CookieSecurePolicy.SameAsRequest;
if (Preferences.HttpProtocolSecure())
options.Cookie.SecurePolicy = CookieSecurePolicy.Always;
else
options.Cookie.SecurePolicy = CookieSecurePolicy.SameAsRequest;
options.Cookie.IsEssential = true;
string sessionCookieName = GxWebSession.GetSessionCookieName(VirtualPath);
if (!string.IsNullOrEmpty(sessionCookieName))
Expand Down Expand Up @@ -562,6 +566,10 @@ public void Configure(IApplicationBuilder app, Microsoft.AspNetCore.Hosting.IHos
provider.Mappings[mapping.Key] = mapping.Value;
}
}
app.UseForwardedHeaders(new ForwardedHeadersOptions
{
ForwardedHeaders = ForwardedHeaders.XForwardedProto | ForwardedHeaders.XForwardedFor
});
if (GXUtil.CompressResponse())
{
app.UseResponseCompression();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ public void Init(HttpApplication app)

private void Session_Start(object sender, EventArgs e)
{
if (App.Request.GetIsSecureFrontEnd() || App.Request.GetIsSecureConnection() == 1)
if (App.Request.GetIsSecureFrontEnd() || App.Request.GetIsSecureConnection() == 1 || Preferences.HttpProtocolSecure())
{
HttpCookie sessionCookie = RetrieveResponseCookie(App.Response, cookieName);

Expand Down
Loading