title: RestTemplate vs Postman: Identical in Wireshark but only one works
body: <p>I'm trying to recreate a request that works in Postman using a Spring RestTemplate. I've tried to make the requests identical, down to the fake &quot;User-Agent&quot; header, but for whatever reason the one from Postman returns <code>200 OK</code> and the one from RestTemplate returns <code>301 Moved</code>.</p>
  <p>What could I possibly be doing wrong?</p>
  <p>Both requests are below, &quot;anonymized&quot; by removing the <em>urls</em> and <em>session cookie</em>, <strong>both of which are identical</strong> - confirmed by copying one and searching the other.</p>
  <p><strong>This is the working request from Postman.</strong></p>
  <pre><code>Frame 1541: 638 bytes on wire (5104 bits), 638 bytes captured (5104 bits) on interface en0, id 0
  Transmission Control Protocol, Src Port: 51102, Dst Port: 80, Seq: 573, Ack: 840, Len: 572
  
  Hypertext Transfer Protocol
      POST &lt;removed&gt; HTTP/1.1\r\n
      User-Agent: Java/17.0.2\r\n
      Accept: text/plain, application/json, application/*+json, */*\r\n
      Content-Type: application/x-www-form-urlencoded; charset=UTF-8\r\n
      Cookie: JSESSIONID=&quot;&lt;removed&gt;&quot;\r\n
      Host: &lt;removed&gt;\r\n
      Connection: keep-alive\r\n
      Content-Length: 63\r\n
      \r\n
      [Full request URI: &lt;removed&gt;
      [HTTP request 2/2]
      [Prev request in frame: 1373]
      [Response in frame: 1596]
      File Data: 63 bytes
  HTML Form URL Encoded: application/x-www-form-urlencoded
      Form item: &quot;&lt;removed&gt;&quot; = &quot;&lt;removed&gt;&quot;
          Key: &lt;removed&gt;
          Value: &lt;removed&gt;
  </code></pre>
  <p><strong>This is the failing request using RestTemplate.</strong></p>
  <pre><code>Frame 3365: 129 bytes on wire (1032 bits), 129 bytes captured (1032 bits) on interface en0, id 0
  Transmission Control Protocol, Src Port: 51110, Dst Port: 80, Seq: 509, Ack: 1, Len: 63
  [2 Reassembled TCP Segments (571 bytes): #3363(508), #3365(63)]
  Hypertext Transfer Protocol
      POST &lt;removed&gt; HTTP/1.1\r\n
      User-Agent: Java/17.0.2\r\n
      Accept: text/plain, application/json, application/*+json, */*\r\n
      Content-Type: application/x-www-form-urlencoded;charset=UTF-8\r\n
      Cookie: JSESSIONID=&quot;&lt;removed&gt;&quot;\r\n
      Host: &lt;removed&gt;\r\n
      Connection: keep-alive\r\n
      Content-Length: 63\r\n
      \r\n
      [Full request URI: &lt;removed&gt;
      [HTTP request 1/1]
      [Response in frame: 3377]
      File Data: 63 bytes
  HTML Form URL Encoded: application/x-www-form-urlencoded
      Form item: &quot;&lt;removed&gt;&quot; = &quot;&lt;removed&gt;&quot;
          Key: &lt;removed&gt;
          Value: &lt;removed&gt;
  </code></pre>