Wednesday, December 21, 2016

REQUEST_HOST_HEADER Property in WSO2 ESB

The value of this property will be set as the HTTP host header of outgoing request. ESB will set hostname of target endpoint as the HTTP host header.

Sample ESB Sequence


<?xml version="1.0" encoding="UTF-8"?>
<sequence name="request" onError="fault" xmlns="http://ws.apache.org/ns/synapse">
    <property name="REQUEST_HOST_HEADER" scope="axis2" value="httpbin.org"/>
    <log level="full"/>
    <call blocking="true">
        <endpoint>
            <http method="GET" uri-template="http://httpbin.org/get"/>
        </endpoint>
    </call>
</sequence>

Sample Response


[2016-12-21 22:09:08,496] DEBUG - headers http-outgoing-1 >> GET /get HTTP/1.1
[2016-12-21 22:09:08,497] DEBUG - headers http-outgoing-1 >> Host: httpbin.org
[2016-12-21 22:09:08,497] DEBUG - headers http-outgoing-1 >> Connection: Keep-Alive
[2016-12-21 22:09:08,497] DEBUG - headers http-outgoing-1 >> User-Agent: Synapse-PT-HttpComponents-NIO
[2016-12-21 22:09:08,498] DEBUG - wire HTTP-Sender I/O dispatcher-1 << "GET /get HTTP/1.1[\r][\n]"
[2016-12-21 22:09:08,498] DEBUG - wire HTTP-Sender I/O dispatcher-1 << "Host: httpbin.org[\r][\n]"
[2016-12-21 22:09:08,498] DEBUG - wire HTTP-Sender I/O dispatcher-1 << "Connection: Keep-Alive[\r][\n]"
[2016-12-21 22:09:08,498] DEBUG - wire HTTP-Sender I/O dispatcher-1 << "User-Agent: Synapse-PT-HttpComponents-NIO[\r][\n]"
[2016-12-21 22:09:08,498] DEBUG - wire HTTP-Sender I/O dispatcher-1 << "[\r][\n]"
[2016-12-21 22:09:08,866] DEBUG - wire HTTP-Sender I/O dispatcher-1 >> "HTTP/1.1 200 OK[\r][\n]"
[2016-12-21 22:09:08,866] DEBUG - wire HTTP-Sender I/O dispatcher-1 >> "Server: nginx[\r][\n]"
[2016-12-21 22:09:08,866] DEBUG - wire HTTP-Sender I/O dispatcher-1 >> "Date: Wed, 21 Dec 2016 16:39:08 GMT[\r][\n]"
[2016-12-21 22:09:08,867] DEBUG - wire HTTP-Sender I/O dispatcher-1 >> "Content-Type: application/json[\r][\n]"
[2016-12-21 22:09:08,867] DEBUG - wire HTTP-Sender I/O dispatcher-1 >> "Content-Length: 182[\r][\n]"
[2016-12-21 22:09:08,867] DEBUG - wire HTTP-Sender I/O dispatcher-1 >> "Connection: keep-alive[\r][\n]"
[2016-12-21 22:09:08,867] DEBUG - wire HTTP-Sender I/O dispatcher-1 >> "Access-Control-Allow-Origin: *[\r][\n]"
[2016-12-21 22:09:08,867] DEBUG - wire HTTP-Sender I/O dispatcher-1 >> "Access-Control-Allow-Credentials: true[\r][\n]"
[2016-12-21 22:09:08,867] DEBUG - wire HTTP-Sender I/O dispatcher-1 >> "[\r][\n]"
[2016-12-21 22:09:08,867] DEBUG - wire HTTP-Sender I/O dispatcher-1 >> "{[\n]"
[2016-12-21 22:09:08,867] DEBUG - wire HTTP-Sender I/O dispatcher-1 >> "  "args": {}, [\n]"
[2016-12-21 22:09:08,867] DEBUG - wire HTTP-Sender I/O dispatcher-1 >> "  "headers": {[\n]"
[2016-12-21 22:09:08,867] DEBUG - wire HTTP-Sender I/O dispatcher-1 >> "    "Host": "httpbin.org", [\n]"
[2016-12-21 22:09:08,868] DEBUG - wire HTTP-Sender I/O dispatcher-1 >> "    "User-Agent": "Synapse-PT-HttpComponents-NIO"[\n]"
[2016-12-21 22:09:08,868] DEBUG - wire HTTP-Sender I/O dispatcher-1 >> "  }, [\n]"
[2016-12-21 22:09:08,868] DEBUG - wire HTTP-Sender I/O dispatcher-1 >> "  "origin": "123.231.111.7", [\n]"
[2016-12-21 22:09:08,868] DEBUG - wire HTTP-Sender I/O dispatcher-1 >> "  "url": "http://httpbin.org/get"[\n]"
[2016-12-21 22:09:08,868] DEBUG - wire HTTP-Sender I/O dispatcher-1 >> "}[\n]"

No comments:

Post a Comment