Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-69778

createItem returns a 302 (redirect to a ui page) even if i am in REST mode

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Minor Minor
    • core
    • None

      createItem api does return 302 even if accept header is application/json or application/xml

       

      So when doing this: (this is the actual output of a Apache http client)

      DEBUG org.apache.hc.client5.http.headers - c-0000000001 >> :method: POST
      DEBUG org.apache.hc.client5.http.headers - c-0000000001 >> :scheme: https
      DEBUG org.apache.hc.client5.http.headers - c-0000000001 >> :authority: xxxx
      DEBUG org.apache.hc.client5.http.headers - c-0000000001 >> :path: /createItem?name=sandbox_C253ZR_NONE&mode=copy&from=salesDemo_DEV
      DEBUG org.apache.hc.client5.http.headers - c-0000000001 >> content-type: application/json
      DEBUG org.apache.hc.client5.http.headers - c-0000000001 >> accept: application/json
      DEBUG org.apache.hc.client5.http.headers - c-0000000001 >> jenkins-crumb: XXXX
      DEBUG org.apache.hc.client5.http.headers - c-0000000001 >> user-agent: Apache-HttpAsyncClient/5.1.2 (Java/17.0.4)
      DEBUG org.apache.hc.client5.http.headers - c-0000000001 >> authorization: XXXX

       

      then i don't get right away 200 back but a redirect to a pure UI page

      (and i did set that i only accept application/json (or xml which also doesn't matter)

       

      DEBUG org.apache.hc.client5.http.headers - c-0000000001 << :status: 302
      DEBUG org.apache.hc.client5.http.headers - c-0000000001 << date: Wed, 05 Oct 2022 09:30:13 GMT
      DEBUG org.apache.hc.client5.http.headers - c-0000000001 << x-content-type-options: nosniff
      DEBUG org.apache.hc.client5.http.headers - c-0000000001 << location: https://XXXXXXX/job/sandbox_C253ZR_NONE/configure
      DEBUG org.apache.hc.client5.http.headers - c-0000000001 << content-length: 0
      DEBUG org.apache.hc.client5.http.headers - c-0000000001 << server: Jetty(10.0.11)
      DEBUG org.apache.hc.client5.http.headers - c-0000000001 << strict-transport-security: max-age=31536000
      DEBUG org.apache.hc.client5.http.headers - c-0000000001 << set-cookie: INGRESSCOOKIE=XXXXX path=/; HttpOnly; Secure

       

      that really doesn't look ok, if i use REST and i set the right accept then it shouldn't redirect me to a UI page.

      This really looks like a createJob done through the ui

            Unassigned Unassigned
            jcompagner Johan Compagner
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: