This Set-Cookie was blocked because its Domain attribute is invalid with regards to the current host URL

amol 1 Reputation point
2021-03-17T19:38:24.567+00:00

In my application, I have Azure AD authentication OpenId connect authentication scheme, and my app is running behind the application gateway. I am facing an issue while authenticating from the application gateway URL which is public and my backend application URL is restricted for public use. For ex. this is my application gateway URL example.com and this is for backend application example.azurewebsites.net.

When I hit the example.com URL in the browser I redirected to the Microsoft site for the login then I log in after successful login I am redirected to the example.com/sign-oidc URL, and that's where the problem starts. When I saw the response header of the example.com/sign-oidc in the network tab of the browser, I got this warning message "This Set-Cookie was blocked because its Domain attribute is invalid with regards to the current host URL" for the Set-Cookie header, its domain attribute was set to example.azurewebsites.net. I think this should be the application gateway's URL which is example.com.

This issue preventing me to log into the system.

Many thanks,

Azure Active Directory
Azure Active Directory
An Azure enterprise identity service that provides single sign-on and multi-factor authentication.
12,603 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.
558 questions
{count} votes

2 answers

Sort by: Most helpful
  1. VipulSparsh-MSFT 15,956 Reputation points
    2021-03-25T12:32:05.83+00:00

    @amol Apologies for delay on this , the scenario you are in might be an expected one. This needs some configuration changes at the Application gateway level. You can go through this to figure out what you need : https://learn.microsoft.com/en-us/azure/application-gateway/rewrite-http-headers-url#modify-a-redirection-url

    No comments

  2. Mahesh Patil 0 Reputation points
    2023-01-12T11:28:40.81+00:00

    I tried the solution provided in link. after implementation now URL is not changing but getting below error:
    User's image

    No comments