title: jenkins responds "HTTP/1.1 302 Found" when trying to access /lastBuild/api/json
body: <p>I'm trying to access jenkins (v2.177) API using curl. For instance, I try to get the lastbuild number as follows :  </p>
  
  <pre><code>curl -v -u user:pass http://myjenkins:port/job/myjob/lastBuild/api/json
  </code></pre>
  
  <p>Insted of giving me a json, I get a "302 Found" with Content-Length egal to zero ! : </p>
  
  <pre><code>`*   Trying 11.90.1.9...
  * TCP_NODELAY set
  * Connected to 11.90.1.9 (11.90.1.9) port 8484 (#0)
  * Server auth using Basic with user 'user7'
  &gt; GET /job/myjob/lastBuild HTTP/1.1
  &gt; Host: 11.90.1.9:8484
  &gt; Authorization: Basic dGVzdGl.../blc2Y...
  &gt; User-Agent: curl/7.58.0
  &gt; Accept: */*
  &gt; 
  &lt; HTTP/1.1 302 Found
  &lt; Date: Tue, 14 May 2019 13:01:12 GMT
  &lt; X-Content-Type-Options: nosniff
  &lt; Location: http://11.90.1.9:8484/job/myjob/
  &lt; Content-Length: 0
  &lt; Server: Jetty(9.4.z-SNAPSHOT)
  &lt; 
  * Connection #0 to host 11.90.1.9 left intact`
  </code></pre>
  
  <p>Any idea why I don't get the JSON ? </p>