7.2 MVC + jQuery on .net Core
We are trying out our platform behind an Azure Application Gateway running on an Azure App Service. The public DNS would be something like https://public.domain.com but when trying to log in to "/App/SomeController" the user gets redirected to "https://private.azurewebsites.net/Account/Login?ReturnUrl=/App/SomeController" which is the private DNS behind the gateway.
The "private.azurewebsites.net" does not exist in any appsetting so it looks like it is being picked up by the HttpContext.
Do you know how this can be overridden? As it looks to be handled in the Abp code rather than Zero.
Thanks, Dave
6 Answer(s)
-
0
Hi,
You cna take a look at https://docs.microsoft.com/en-us/aspnet/core/host-and-deploy/proxy-load-balancer?view=aspnetcore-3.1. If you use forwarded headers, your app should get correct HOST from the HttpContext.
-
0
Thanks, I hadn't seen that before so we will investigate. I'll update this post with the end result in case anyone else needs to know in the future.
-
0
The middleware change didn't work for us so we will now look into something on the Azure Application Gateway instead, based on this: https://docs.microsoft.com/en-us/azure/application-gateway/rewrite-http-headers#modify-a-redirection-url
-
0
Hi @CrayonGroupSCA
There are some other criterias for header forwarding of ASP.NET Core. However, you can simply write a middleware like below and set it yourself;
app.Use((httpContext, next) => { httpContext.Request.Scheme = "https"; return next(); });
-
0
Thanks for that suggestion, have tried it out and its working on our Test / Staging servers which have a static url so we know where to change the context to. Hopefully next week can try it out on our mock production site to see how it works with the Tenancy name in the url.
-
0
Hi @CrayonGroupSCA
Great :). Please let us know if you face any other problems.