'431 - (Request Header Fields Too Large)

First time posting a question please keep it in mind when reading

Things i tried: Cleared my google chrome cache and cookies, tried incognito mode, updated my node to the latest version still getting the same error.

Error I'm Getting chrome: Failed to load resource: the server responded with a status of 431 (Request Header Fields Too Large)

auth.js:22 doubt its relevant but source in dev tools Giving me the error at fetch part

export const authInit = data => {
      const { user, type } = data;
      let url;
      if (type === "Login") {
        url = "/api/auth/login";
      } else if (type === "Register") {
        url = "/api/auth/register";
      }
      return dispatch => {
        dispatch({ type: actionTypes.LOADING });
        return fetch(url, {
          method: "POST",
          body: JSON.stringify(user),
          headers: {
            "Content-Type": "application/json"
          }
        })
          .then(res => res.json())
          .then(response => {
            if (!response.success) {
              return dispatch(authError(response.messages));
            }


Solution 1:[1]

Maybe should you try this.

It's talking about an error about node js header size :

article

You should run node with --max-http-header-size=16384 for eg.

If you run the server with npm start, so just modify the script in the package.json


Maybe another problem with the body parser of express ?

var bodyParser = require('body-parser')
app.use(bodyParser(){limit:5000kb})

You can find the doc here about body options

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1