[jboss-jira] [JBoss JIRA] (WFLY-13397) MP HeaderPropagation does not propagate headers

Thimo König (Jira) issues at jboss.org
Wed Apr 22 10:36:10 EDT 2020


     [ https://issues.redhat.com/browse/WFLY-13397?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Thimo König updated WFLY-13397:
-------------------------------
    Description: 
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:
{code}
curl -i -H "Accept: application/json" -H "Header2Propagate: PropagatedValue" http://localhost:8080/mp-hp/api/client {code}

The expected result should be:
{code:JSON}
{
    "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]"
        }
    }
}
{code}
but since the header is not propagated you are getting only this:
{code:JSON}
{
    "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]"
        }
    }
}
{code}

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

  was:
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:
{code}
curl -i -H "Accept: application/json" -H "Header2Propagate: PropagatedValue" http://localhost:8080/mp-hp/api/client {code}

The expected result should be:
{code:JSON}
{
    "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]"
        }
    }
}
{code}
but since the header is not propagated you are getting only this:
{code:JSON}
{
    "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]"
        }
    }
}
{code}

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



> MP HeaderPropagation does not propagate headers
> -----------------------------------------------
>
>                 Key: WFLY-13397
>                 URL: https://issues.redhat.com/browse/WFLY-13397
>             Project: WildFly
>          Issue Type: Bug
>    Affects Versions: 19.0.0.Final
>            Reporter: Thimo König
>            Assignee: Brian Stansberry
>            Priority: Major
>         Attachments: mp-headerpropagation-1.0.0-SNAPSHOT.war, openliberty_response.json, wildfly_response.json
>
>
> 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:
> {code}
> curl -i -H "Accept: application/json" -H "Header2Propagate: PropagatedValue" http://localhost:8080/mp-hp/api/client {code}
> The expected result should be:
> {code:JSON}
> {
>     "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]"
>         }
>     }
> }
> {code}
> but since the header is not propagated you are getting only this:
> {code:JSON}
> {
>     "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]"
>         }
>     }
> }
> {code}
> This issue has already been discussed on https://groups.google.com/forum/#!topic/wildfly/QOx3AfrXAMc and Rebecca Searls (rseals at redhat.com) ask me to file this bug report



--
This message was sent by Atlassian Jira
(v7.13.8#713008)



More information about the jboss-jira mailing list