title: Server sending 400 on valid request from client
body: <p>I am using a third-party remote agent that sends a POST request on some event. The POST request can be sent to any server that accepts POST so I spun up a quick flask instance.</p>
  <pre class="lang-py prettyprint-override"><code># main.py
  
  from flask import Flask, request
  app = Flask(__name__)
  
  @app.route('/', methods=['POST'])
  def hello():
      # Logging request data to console
    return request.get_data()
  </code></pre>
  <p>This simple server works well and tested with Postman. Now, when the event occurs and the remote agent tries to send data to my server, I am getting below in the logs.</p>
  <pre><code>* Detected change in '/Users/my/path/main.py', reloading
   * Restarting with stat
   * Debugger is active!
   * Debugger PIN: 000-000-000
  192.168.1.2 - - [06/Aug/2020 12:06:39] code 400, message Bad HTTP/0.9 request type ('POST')
  192.168.1.2 - - [06/Aug/2020 12:06:39] &quot;POST HTTP/1.1&quot; HTTPStatus.BAD_REQUEST -
  </code></pre>
  <p>Here's what I captured on wireshark:</p>
  <pre><code>POST HTTP/1.1
  Host:192.168.1.1
  User-Agent:Mozilla/5.0 (Windows NT 6.1; WOW64; rv:47.0) Gecko/20100101 Firefox/47.0
  Content-length: 6937
  Content-type: text/xml
  Connection: Keep-Alive
  
  AgentID=ABCD
  DataPoint=111
  MoreDataPoint=222
  &lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.01//EN&quot;
          &quot;http://www.w3.org/TR/html4/strict.dtd&quot;&gt;
  &lt;html&gt;
      &lt;head&gt;
          &lt;meta http-equiv=&quot;Content-Type&quot; content=&quot;text/html;charset=utf-8&quot;&gt;
          &lt;title&gt;Error response&lt;/title&gt;
      &lt;/head&gt;
      &lt;body&gt;
          &lt;h1&gt;Error response&lt;/h1&gt;
          &lt;p&gt;Error code: 400&lt;/p&gt;
          &lt;p&gt;Message: Bad HTTP/0.9 request type ('POST').&lt;/p&gt;
          &lt;p&gt;Error code explanation: HTTPStatus.BAD_REQUEST - Bad request syntax or unsupported method.&lt;/p&gt;
      &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  <p>I am not able to figure out why my server is rejecting the request with 400.</p>