Uploaded image for project: 'WildFly'
  1. WildFly
  2. WFLY-13397

MP HeaderPropagation does not propagate headers

XMLWordPrintable

      When calling a JAX-RS Resource from another JAX-RS Resource using the MP RestClient the propagation of headers does not work. I have created a sample app which is available on github https://github.com/koenigt/headerpropagation and attached mp-headerpropagation-1.0.0-SNAPSHOT.war to this report aswell.

      Deploy the sample app and use CURL like:

      curl -i -H "Accept: application/json" -H "Header2Propagate: PropagatedValue" http://localhost:8080/mp-hp/api/client 

      The expected result should be:

      {
          "Name": "ClientResource",
          "org.eclipse.microprofile.rest.client.propagateHeaders": "Authorization,Accept-Language,Header2Propagate",
          "IncomingRequestHeaders": {
              "Accept": "[*/*]",
              "accept-encoding": "[gzip, deflate, br]",
              "Cache-Control": "[no-cache]",
              "connection": "[keep-alive]",
              "Content-Type": "[null]",
              "Header2Propagate": "[PropagatedValue]",
              "Host": "[localhost:9080]",
              "Postman-Token": "[8105e2ef-9b5f-4b3f-a7a9-cea73d51efee]",
              "User-Agent": "[PostmanRuntime/7.24.0]"
          },
          "ServerResponse": {
              "Name": "ServerResource",
              "IncomingRequestHeaders": {
                  "Accept": "[application/json]",
                  "Cache-Control": "[no-cache]",
                  "connection": "[keep-alive]",
                  "content-type": "[application/json]",
                  "Header2Propagate": "[PropagatedValue]",
                  "Host": "[localhost:9080]",
                  "MyClientHeader": "[newHeaderValue]",
                  "Pragma": "[no-cache]",
                  "User-Agent": "[Apache-CXF/3.3.3-SNAPSHOT]"
              }
          }
      }
      

      but since the header is not propagated you are getting only this:

      {
          "Name": "ClientResource",
          "org.eclipse.microprofile.rest.client.propagateHeaders": "Authorization,Accept-Language,Header2Propagate",
          "IncomingRequestHeaders": {
              "Accept": "[*/*]",
      	"Accept-Encoding": "[gzip, deflate, br]",
      	"Cache-Control": "[no-cache]",
      	"Connection": "[keep-alive]",
      	"Header2Propagate": "[PropagatedValue]",
      	"Host": "[localhost:8080]",
              "Postman-Token": "[6e36736f-3b55-4f34-9f39-063dbd4f4e8f]",
              "User-Agent": "[PostmanRuntime/7.24.0]"
          },
          "ServerResponse": {
              "Name": "ServerResource",
              "IncomingRequestHeaders": {
                  "Accept": "[application/json]",
      	    "Connection": "[Keep-Alive]",
      	    "Host": "[localhost:8080]",
      	    "User-Agent": "[Apache-HttpClient/4.5.11 (Java/12)]",
                  "uber-trace-id": "[a0d9d0ac4c54614%3Ac82190f35d41f958%3Aa0d9d0ac4c54614%3A1]"
              }
          }
      }
      

      This issue has already been discussed on https://groups.google.com/forum/#!topic/wildfly/QOx3AfrXAMc and Rebecca Searls (rseals@redhat.com) ask me to file this bug report

        1. mp-headerpropagation-1.0.0-SNAPSHOT.war
          10 kB
          Thimo König
        2. openliberty_response.json
          1 kB
          Thimo König
        3. wildfly_response.json
          0.9 kB
          Thimo König

            jperkins-rhn James Perkins
            koenigt Thimo König (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved: