question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

431 Request Header Fields Too Large due to msal long cookie send in headers

See original GitHub issue

Please follow the issue template below. Failure to do so will result in a delay in answering your question.

Library

  • msal@1.2.1

Framework

React v16.6

Description

Due to loo long cookie send in request header azure webapp returning 431 error ie request headers field too large. After looking into the issues found that cookie send in the header is too long causing this issue.

cookie shown in request headers(in chrome network tab) contains a long info about msal as follows. It contains msal login urls, client-info, nonce, authority and many other thing prefixed with msal.

I think cookie sent as header contain duplicate info about msal…

Configuration

const config = {
      auth: {
        clientId: process.env.REACT_APP_EnterpriseADAppClientID,
        redirectUri: redirectUri,
        postLogoutRedirectUri : redirectUri
      },
      cache: {
        cacheLocation: "localStorage",
        storeAuthStateInCookie: true
      },
      system: {
        logger: logger,
        tokenRenewalOffsetSeconds: 300
      }
    }

Browsers

Chrome

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

2reactions
AbhaysinghBhosalecommented, Jun 10, 2020

Even after updating to latest version getting same issue, Cookie size in the request header is still the same

0reactions
jasonnuttercommented, Mar 2, 2020

Closing as duplicate, tracked in #1188

Read more comments on GitHub >

github_iconTop Results From Across the Web

How To Fix HTTP Error 431 Request Header Fields Too Large
Typically, the HTTP error 431 is caused by issues with cookies, long referrer URLs, or just the total size of the request headers....
Read more >
431 Request Header Fields Too Large - HTTP - MDN Web Docs
The Referer URL is too long; There are too many Cookies sent in the request. Status. 431 Request Header Fields Too Large
Read more >
msal.js - Error 431 Request Header Fields Too Large after ...
Due to loo long cookie send in request header azure webapp returning 431 error ie request headers field too large.
Read more >
HTTP Error 431: 3 Ways to Fix Request Header Fields Too ...
The HTTP Error 431: Request Header Fields Too Large response status code indicates that the origin server refuses to fulfill users' requests.
Read more >
431 Request Header Fields Too Large - Nuxt Auth With Azure ...
These cookies are meant only for MSAL, but they could get sent with an AJAX request sent to the server, and if these...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found