431 (Request Header Fields Too Large) (ReactJS/ Flask)

Viewed 555

I'm getting a 431 error on a simple fetch post, specifically:

net::ERR_ABORTED 431 (Request Header Fields Too Large)

Proxy set to: "proxy": "http://0.0.0.0:3000" (on reactjs)

fetch("/process_image", {
  method:"POST",
  cache: "no-store",
  headers:{
      "content_type":"application/json",
  },
  body:JSON.stringify("testing")
  }
).then(response => {

  //return response.json()
})
.then(json => {

//this.setState({playerName: json[0]})
});

I have tried to clear the cache and cookies on my browser based on the solutions similar to my problem but nothing is helping, and I wouldn't think this would cause an issue since all I'm passing is a small text.

I have also tried to replicate my solution using .net core, and I am able to post data with no issues, but using .net core does not fit in my scope. (I'm learning how to use flask)

I'm passing the data to a .py file:

from flask import Flask, request, jsonify
from flask_cors import CORS
import Image, io, base64
import numpy as np
from keras import models

app = Flask(__name__)
CORS(app)

@app.route("/")
def home():
    return "Hello, Flask!"

@app.route("/process_image", methods=['GET', 'POST'])
def process_image():
    data_uri = request.json()
    print("hello:    ", data_uri)

Any ideas what could be causing the problem?

0 Answers
Related