Open Closed

POST, PUT, and DELETE requests return a Bad Request (400) error #7937


User avatar
0
serhatuysal created
  • ABP Framework version: v8.1.0

  • UI Type: Angular

  • Database System: EF Core (SQL Server)

  • Tiered (for MVC) or Auth Server Separated (for Angular): yes

  • Exception message and full stack trace:

  • Steps to reproduce the issue:

  • Hello,

    After publishing an Angular project to IIS in the production environment, when the resolution width is smaller than 1200px, POST, PUT, and DELETE requests return a Bad Request (400) error. Only GET requests return 200. However, when the resolution is larger than 1200px, the application works without any issues.


13 Answer(s)
  • User Avatar
    0
    liangshiwei created
    Support Team Fullstack Developer

    Hi,

    could you please share the error logs?

  • User Avatar
    0
    serhatuysal created

    2024-09-19 08:16:52.688 +03:00 [INF] Request starting HTTP/1.1 POST http://iktest...tr/api/api/app/home/yayinda-olan-ilan-listesi - null 0 2024-09-19 08:16:52.688 +03:00 [INF] CORS policy execution successful. 2024-09-19 08:16:52.710 +03:00 [INF] Executing endpoint 'InsanKaynaklari.Homes.HomeAppService.yayindaOlanIlanListesi (InsanKaynaklari.Application)' 2024-09-19 08:16:52.710 +03:00 [INF] Route matched with {action = "yayindaOlanIlanListesi", controller = "Home", area = "", page = ""}. Executing controller action with signature System.Threading.Tasks.Task1[System.Collections.Generic.List1[InsanKaynaklari.Ilans.YayindakiIlanDto]] yayindaOlanIlanListesi() on controller InsanKaynaklari.Homes.HomeAppService (InsanKaynaklari.Application). 2024-09-19 08:16:52.710 +03:00 [WRN] The provided antiforgery token was meant for a different claims-based user than the current user. 2024-09-19 08:16:52.711 +03:00 [INF] Authorization failed for the request at filter 'Volo.Abp.AspNetCore.Mvc.AntiForgery.AbpAutoValidateAntiforgeryTokenAuthorizationFilter'. 2024-09-19 08:16:52.711 +03:00 [INF] Executing StatusCodeResult, setting HTTP status code 400 2024-09-19 08:16:52.711 +03:00 [INF] Executed action InsanKaynaklari.Homes.HomeAppService.yayindaOlanIlanListesi (InsanKaynaklari.Application) in 0.5579ms 2024-09-19 08:16:52.711 +03:00 [INF] Executed endpoint 'InsanKaynaklari.Homes.HomeAppService.yayindaOlanIlanListesi (InsanKaynaklari.Application)' 2024-09-19 08:16:52.718 +03:00 [INF] Request finished HTTP/1.1 POST https://iktest...tr/api/api/app/home/yayinda-olan-ilan-listesi - 400 0 null 29.8056ms

  • User Avatar
    0
    liangshiwei created
    Support Team Fullstack Developer

    The provided antiforgery token was meant for a different claims-based user than the current user.

    Hi,

    This is a problem related to CSRF.

    could you please share the full steps to reproduce? I will check it out

  • User Avatar
    0
    serhatuysal created

    Angular project or InsanKaynaklari.HttpApi.Host project? Do you have a remote connection and review status? The project needs to be completed quickly. please

  • User Avatar
    0
    liangshiwei created
    Support Team Fullstack Developer

    Angular project or InsanKaynaklari.HttpApi.Host project?

    both of them.

    The project needs to be completed quickly. please

    if you can share the steps, i will check it know

  • User Avatar
    0
    serhatuysal created

    Can you please connect via remote desktop?

  • User Avatar
    0
    liangshiwei created
    Support Team Fullstack Developer

    Hi,

    How do I do that?

  • User Avatar
    0
    serhatuysal created

    Can you share your email address and I will send you remote connection information?

  • User Avatar
    0
    liangshiwei created
    Support Team Fullstack Developer

    okay shiwei.liang@volosoft.com

  • User Avatar
    0
    liangshiwei created
    Support Team Fullstack Developer

    Hi,

    The problem is ng sends the wrong cookies to the API backend.

    These cookies come from the SSO server.

    you can set different cookie path for your SSO server

  • User Avatar
    0
    liangshiwei created
    Support Team Fullstack Developer
    // your SSO project
    context.Services.ConfigureApplicationCookie(options =>
    {
        options.Cookie.Path = "/auth"; // or /sso anything you wants
    });
    Configure<AbpAntiForgeryOptions>(options =>
    {
        options.TokenCookie.Path = "/auth";
    });
    
  • User Avatar
    0
    liangshiwei created
    Support Team Fullstack Developer

    https://stackoverflow.com/questions/49389306/stop-sharing-cookies-between-applications-under-same-site-id-in-iis

  • User Avatar
    0
    masum.ulu created
    Support Team Angular Expert

    Selamlar, sorunu anlayıp çözümü uygulayabildiniz mi acaba ?

Made with ❤️ on ABP v9.1.0-preview. Updated on November 11, 2024, 11:11