title: After signin to IdentityServer a redirectUrl route doesn't open method, but returns POST 302
body: <p>.Net Core 3.1 </p>
  
  <p>Nginx reverse proxy.</p>
  
  <p><strong>My custom callback url works, but doesn't load in Mvc Client controller method. It's very strange.</strong></p>
  
  <p>MVC client login into IdentityServer and after that IdentityServer redirects to previous Url. For example authorize link is /Home/Privacy. After success login I will be redirect to this page. It's good.</p>
  
  <p>But I want get this schema:</p>
  
  <ol>
  <li>Mvc Client (from /Home/Privacy) signin with IdentityServer.</li>
  <li>After that IdentityServer redirects to url signin-callback, where Mvc Client route call to controller method SignedIn and do work.</li>
  <li>SignedIn redirects to previous url (/Home/Privacy).</li>
  </ol>
  
  <p><strong>I have problem with the second step.</strong></p>
  
  <p><strong>MVC Client</strong></p>
  
  <p>AccountController.cs</p>
  
  <pre><code>[HttpPost("signin-callback")]
   public IActionResult SignedIn()
   {
      _cache.SetString("message", "Good day!");
      Console.WriteLine("&lt;&lt;&lt; Ok &gt;&gt;&gt;");
  
      return View();
   }
  </code></pre>
  
  <p>Startup.cs</p>
  
  <pre><code>services.AddAuthentication(options =&gt;
              {
                  options.DefaultScheme = "Cookies";
                  options.DefaultChallengeScheme = "oidc";
  
              })
                  .AddCookie("Cookies", options =&gt;
                  {
                      options.Cookie.HttpOnly = true;                  
                      options.ExpireTimeSpan = TimeSpan.FromMinutes(10);
                      options.SlidingExpiration = true;
                  })
                  .AddOpenIdConnect("oidc", options =&gt;
                  {
  
                      options.Authority = $"{OpenId["Url"]}/auth";
                      options.RequireHttpsMetadata = false;
                      options.ClientId = OpenId["ClientId"];
                      options.ClientSecret = OpenId["ClientSecret"];
                      options.ResponseType = "code";
                      options.UsePkce = true;
                      options.SignInScheme = "Cookies";
  
                      options.CallbackPath = "/signin-callback";
                      options.GetClaimsFromUserInfoEndpoint = true;
                      options.Scope.Clear();
                      options.Scope.Add("openid");
                      options.Scope.Add("offline_access");
                      options.ClaimActions.MapJsonKey("website", "website");
                      options.SaveTokens = true;
                      options.Events = new OpenIdConnectEvents
                      {
  
                          OnRedirectToIdentityProvider = ctx =&gt;
                          {
                              ctx.ProtocolMessage.RedirectUri = "http://address.com/editor/signin-callback";
                              return Task.FromResult(0);
                          },
  
  
  
                          OnTicketReceived = (e) =&gt;
                         {
                             e.Properties.IsPersistent = true;
                             e.Properties.ExpiresUtc = DateTimeOffset.UtcNow.AddMinutes(60);
                             return Task.CompletedTask;
                         }
                      };
  
                  });
         services.AddControllersWithViews();
  ......
  }
  
   public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
   {
     app.UsePathBase("/editor");
     app.UseStaticFiles();
  
     app.UseRouting();
  
     app.UseAuthentication();
     app.UseAuthorization();
  
  app.UseEndpoints(endpoints =&gt;
              {
                  endpoints.MapControllerRoute(
                      name: "default",
                      pattern: "{controller=Home}/{action=Index}/{id?}");
                  endpoints.MapControllers();
              });
   }
  </code></pre>
  
  <p><strong>IdentityServer</strong></p>
  
  <p>Config.cs</p>
  
  <pre><code>new Client
  {
        ClientId = ...,
        ClientName = ...,
        ClientSecrets = { ...},
  
        AllowedGrantTypes = GrantTypes.CodeAndClientCredentials,
        RequireConsent = false,
        RequirePkce = true,
        FrontChannelLogoutSessionRequired = false,
        IdentityTokenLifetime = 300,
        AccessTokenLifetime = 1200,
        AuthorizationCodeLifetime = 300,
        AllowedCorsOrigins = {
                          "http://address.com"
        },
  
  
      RedirectUris = {
               "http://address.com/editor/signin-callback"                       
     },
  
  
     PostLogoutRedirectUris = {
                          ....
                      },
   AllowOfflineAccess = true,
   AllowAccessTokensViaBrowser = true,
   AllowedScopes = new List&lt;string&gt;
   {
         IdentityServerConstants.StandardScopes.OpenId,
         IdentityServerConstants.StandardScopes.Profile
  
   }
  }
  </code></pre>
  
  <p>Startup.cs</p>
  
  <pre><code>public void ConfigureServices(IServiceCollection services)
  {
   ....
  
  
  services.AddIdentity&lt;ApplicationUser, IdentityRole&gt;(config =&gt;
              {
                  config.SignIn.RequireConfirmedEmail = true;
              })
                  .AddEntityFrameworkStores&lt;ApplicationDbContext&gt;()
                  .AddDefaultTokenProviders();
  
  
   var builder = services.AddIdentityServer(options =&gt;
              {
                  options.Events.RaiseErrorEvents = true;
                  options.Events.RaiseInformationEvents = true;
                  options.Events.RaiseFailureEvents = true;
                  options.Events.RaiseSuccessEvents = true;
                  options.Cors.CorsPaths.Add("/Account/AntiForgery");
                  options.Cors.CorsPaths.Add("/Account/Login");
                  options.Cors.CorsPaths.Add(null);
  ....
  services.AddAuthentication();
  ....
  services.AddCors(options =&gt;
              {
                  // this defines a CORS policy called "default"
                  options.AddPolicy("CorsPolicy", policy =&gt;
                  {
  
                      policy.WithOrigins("http://address.com")
                          .AllowAnyHeader()
                          .AllowAnyMethod()
                          .AllowCredentials();
                  });
              });
  
              })
  }
  
  public void Configure(IApplicationBuilder app)
          {
              app.UseCors("CorsPolicy");
              app.UsePathBase("/auth");
  ...
  }
  
  </code></pre>
  
  <p>After login IdentityServer redirects to previous page. But what is wrong with signin-callback url?
  In Chrome:
  <a href="https://i.stack.imgur.com/1vkJH.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/1vkJH.png" alt="enter image description here"></a></p>
  
  <p>I think signin-callback has to load SignedIn method. But in server logs I don't see my mark &lt;&lt;&lt; Ok >>>, and cache is empty.
  When I write wrong url </p>
  
  <pre><code>[HttpPost("signin-callback_what-is-wrong")]
  </code></pre>
  
  <p>Nothing changes. Always Chrome/Nginx in logs writes POST 302 0. 
  I checked this url on HttpGet: address.com/editor/signin-callback. And always get in logs &lt;&lt;&lt; Ok >>>.</p>
  
  <p>This like not real virtual redirect.</p>
  
  <p>I feel like idiot. Two days on this problem - but no results...
  I would appreciate any help. </p>