can't redirect back to my custom domain URL

yehonatan fridman 0 Reputation points

I have a problem with the DOMAIN URL in my Razor Page web app.

Here is the original URL which looks like this:

And there is the custom domain:

I am using the services of an external provider in order to perform 2FA.

Basically what happens is, that after a user enters the email and password, he is transferred to their external page where he has to perform another identification and then he successfully connects and enters the APP.

I need to give an address to which the user should return at the end of the process. The settings look like this:

                         var request = new TrackRequest(

                             UserId: employee.Id.ToString(),

                             Email: employee.Email,

                             Action: "signin",

                             RedirectUrl: $"{HttpContext.Request.Scheme}://{HttpContext.Request.Host}/Login?handler=AuthsignalCallback"


If the visitor enters via the original URL ( then there is no error and everything is fine and works smoothly.

The problem is when the user enters from the custom domain.

For some reason this section:

                             RedirectUrl: $"{HttpContext.Request.Scheme}://{HttpContext.Request.Host}/Login?handler=AuthsignalCallback"

Returns me the original URL and not the CUSTOM one.

I consulted the support of the third-party vendor and he directed me to this Microsoft article:

Emphasis on the part of Incorrect redirect URLs

We do use application Gateawy in our Azure.

Is it possible that im missing some settings ?

Basically, I need to make sure that when a visitor connects through the custom domain, he will be returned to the custom domain and not to the original host url.

I've tried to change the way I'm getting the URL in my code and also tried to change some settings in my Startup.cs but all results were the same ..

Azure DNS
Azure DNS
An Azure service that enables hosting Domain Name System (DNS) domains in Azure.
531 questions
Azure Application Gateway
Azure Application Gateway
An Azure service that provides a platform-managed, scalable, and highly available application delivery controller as a service.
844 questions
{count} votes