From 6c72b154e245d629ef068551f3832b30a6ee8bcc Mon Sep 17 00:00:00 2001 From: pavelbannov Date: Fri, 12 Jul 2019 17:28:14 +0300 Subject: [PATCH 1/3] Server: added ForwardedHeaders --- products/ASC.People/Server/Startup.cs | 6 ++++++ web/ASC.Web.Api/Startup.cs | 6 ++++++ web/ASC.Web.Studio/Startup.cs | 6 ++++++ 3 files changed, 18 insertions(+) diff --git a/products/ASC.People/Server/Startup.cs b/products/ASC.People/Server/Startup.cs index 4b1497a04c..e12e490827 100644 --- a/products/ASC.People/Server/Startup.cs +++ b/products/ASC.People/Server/Startup.cs @@ -15,6 +15,7 @@ using Microsoft.AspNetCore.Authentication; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Hosting; +using Microsoft.AspNetCore.HttpOverrides; using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc.Authorization; using Microsoft.AspNetCore.Mvc.Formatters; @@ -82,6 +83,11 @@ namespace ASC.People app.UseDeveloperExceptionPage(); } + app.UseForwardedHeaders(new ForwardedHeadersOptions + { + ForwardedHeaders = ForwardedHeaders.XForwardedFor | ForwardedHeaders.XForwardedProto + }); + app.UseCors(builder => builder .AllowAnyOrigin() diff --git a/web/ASC.Web.Api/Startup.cs b/web/ASC.Web.Api/Startup.cs index 0260cf3987..25a9c03535 100644 --- a/web/ASC.Web.Api/Startup.cs +++ b/web/ASC.Web.Api/Startup.cs @@ -15,6 +15,7 @@ using Microsoft.AspNetCore.Authentication; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Hosting; +using Microsoft.AspNetCore.HttpOverrides; using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc.Authorization; using Microsoft.AspNetCore.Mvc.Formatters; @@ -80,6 +81,11 @@ namespace ASC.Web.Api app.UseDeveloperExceptionPage(); } + app.UseForwardedHeaders(new ForwardedHeadersOptions + { + ForwardedHeaders = ForwardedHeaders.XForwardedFor | ForwardedHeaders.XForwardedProto + }); + app.UseCors(builder => builder .AllowAnyOrigin() diff --git a/web/ASC.Web.Studio/Startup.cs b/web/ASC.Web.Studio/Startup.cs index a7bd9fd9c0..606d2d91d1 100644 --- a/web/ASC.Web.Studio/Startup.cs +++ b/web/ASC.Web.Studio/Startup.cs @@ -7,6 +7,7 @@ using ASC.Web.Core; using Microsoft.AspNetCore.Authentication; using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Hosting; +using Microsoft.AspNetCore.HttpOverrides; using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Hosting; @@ -58,6 +59,11 @@ namespace ASC.Web.Studio app.UseExceptionHandler("/Error"); } + app.UseForwardedHeaders(new ForwardedHeadersOptions + { + ForwardedHeaders = ForwardedHeaders.XForwardedFor | ForwardedHeaders.XForwardedProto + }); + app.UseRouting(); app.UseCors(builder => From 26baaa81248136ae67c2dd02155e2cd965f0f2c7 Mon Sep 17 00:00:00 2001 From: pavelbannov Date: Fri, 12 Jul 2019 17:29:52 +0300 Subject: [PATCH 2/3] Build: removed building people client --- build/build.bat | 1 - 1 file changed, 1 deletion(-) diff --git a/build/build.bat b/build/build.bat index edad892e9d..489458abd8 100644 --- a/build/build.bat +++ b/build/build.bat @@ -13,7 +13,6 @@ call npm ci --prefix web/ASC.Web.Client echo "ASC.Web.People.Client" call npm ci --prefix products/ASC.People/Client -call npm run build --prefix products/ASC.People/Client echo "ASC.Web.sln" call dotnet build ASC.Web.sln /fl1 /flp1:LogFile=build/ASC.Web.log;Verbosity=Normal From 4f99bacb9877963eb946f82727ebf6e36994fa74 Mon Sep 17 00:00:00 2001 From: pavelbannov Date: Fri, 12 Jul 2019 17:31:15 +0300 Subject: [PATCH 3/3] People.Server: removed pages --- products/ASC.People/Server/Pages/Error.cshtml | 26 ------------------- .../ASC.People/Server/Pages/Error.cshtml.cs | 23 ---------------- .../Server/Pages/_ViewImports.cshtml | 3 --- 3 files changed, 52 deletions(-) delete mode 100644 products/ASC.People/Server/Pages/Error.cshtml delete mode 100644 products/ASC.People/Server/Pages/Error.cshtml.cs delete mode 100644 products/ASC.People/Server/Pages/_ViewImports.cshtml diff --git a/products/ASC.People/Server/Pages/Error.cshtml b/products/ASC.People/Server/Pages/Error.cshtml deleted file mode 100644 index 6f92b95655..0000000000 --- a/products/ASC.People/Server/Pages/Error.cshtml +++ /dev/null @@ -1,26 +0,0 @@ -@page -@model ErrorModel -@{ - ViewData["Title"] = "Error"; -} - -

Error.

-

An error occurred while processing your request.

- -@if (Model.ShowRequestId) -{ -

- Request ID: @Model.RequestId -

-} - -

Development Mode

-

- Swapping to the Development environment displays detailed information about the error that occurred. -

-

- The Development environment shouldn't be enabled for deployed applications. - It can result in displaying sensitive information from exceptions to end users. - For local debugging, enable the Development environment by setting the ASPNETCORE_ENVIRONMENT environment variable to Development - and restarting the app. -

diff --git a/products/ASC.People/Server/Pages/Error.cshtml.cs b/products/ASC.People/Server/Pages/Error.cshtml.cs deleted file mode 100644 index 83cd035720..0000000000 --- a/products/ASC.People/Server/Pages/Error.cshtml.cs +++ /dev/null @@ -1,23 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Diagnostics; -using System.Linq; -using System.Threading.Tasks; -using Microsoft.AspNetCore.Mvc; -using Microsoft.AspNetCore.Mvc.RazorPages; - -namespace ASC.People.Pages -{ - [ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)] - public class ErrorModel : PageModel - { - public string RequestId { get; set; } - - public bool ShowRequestId => !string.IsNullOrEmpty(RequestId); - - public void OnGet() - { - RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier; - } - } -} diff --git a/products/ASC.People/Server/Pages/_ViewImports.cshtml b/products/ASC.People/Server/Pages/_ViewImports.cshtml deleted file mode 100644 index 4e99cbd404..0000000000 --- a/products/ASC.People/Server/Pages/_ViewImports.cshtml +++ /dev/null @@ -1,3 +0,0 @@ -@using ASC.People -@namespace ASC.People.Pages -@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers