Issue: Please find the below logs on how ESB 4.8.1 sends the host header for http endpoints.
[2017-04-28 14:54:00,620] DEBUG - wire << "GET /v2/59030280110000c10b975dc7 HTTP/1.1[\r][\n]" [2017-04-28 14:54:00,620] DEBUG - wire << "Accept-Encoding: gzip,deflate[\r][\n]" [2017-04-28 14:54:00,620] DEBUG - wire << "Host: www.mocky.io:80[\r][\n]" [2017-04-28 14:54:00,620] DEBUG - wire << "Connection: Keep-Alive[\r][\n]" [2017-04-28 14:54:00,620] DEBUG - wire << "User-Agent: Synapse-PT-HttpComponents-NIO[\r][\n]"
As you could see in the above logs it always adds port 80 at the end of Host Header. As a solution you could add below property with the host header that you want the ESB to send the request.
<property name="REQUEST_HOST_HEADER" value="www.mocky.io" scope="axis2"></property>
Configured the below simple API to test the above property.
<api xmlns="http://ws.apache.org/ns/synapse" name="testAPI" context="/testAPI"> <resource methods="GET"> <inSequence> <property name="REQUEST_HOST_HEADER" value="www.mocky.io" scope="axis2"></property> <send> <endpoint> <http method="get" uri-template="http://www.mocky.io/v2/59030280110000c10b975dc7"></http> </endpoint> </send> </inSequence> <outSequence> <send></send> </outSequence> </resource> </api>
We received below logs after adding the REQUEST_HOST_HEADER property in the API.
[2017-04-28 15:13:34,735] DEBUG - wire << "GET /v2/59030280110000c10b975dc7 HTTP/1.1[\r][\n]" [2017-04-28 15:13:34,736] DEBUG - wire << "Host: www.mocky.io[\r][\n]" [2017-04-28 15:13:34,736] DEBUG - wire << "Accept-Encoding: gzip,deflate[\r][\n]" [2017-04-28 15:13:34,736] DEBUG - wire << "Connection: Keep-Alive[\r][\n]" [2017-04-28 15:13:34,736] DEBUG - wire << "User-Agent: Synapse-PT-HttpComponents-NIO[\r][\n]"
No comments:
Post a Comment