How to add extra HTTP Headers to the request sent to Target by API Exchange Gateway?

How to add extra HTTP Headers to the request sent to Target by API Exchange Gateway?

book

Article ID: KB0074039

calendar_today

Updated On:

Products Versions
TIBCO API Exchange 2.3.1 and above

Description

If Apache is in use as a ReverseProxy, it can be used to add additional headers.

Alternately APIX-G can add headers using a transformation or a Full-type Mapping.
Using a stylesheet has additional flexibility of setting conditions to look into the NB Request context as well.

 

Issue/Introduction

This article provides inputs and sample for adding additional headers to the SB HTTP Request.

Environment

All Supported Platforms

Resolution

#viaAPIX
By using a Transformation, APIX can add additional headers to the outgoing/southbound request it sends to the Target.
Please see attached archive for a sample stylesheets
-- this should be configured as a Full-type Mapping and applied as a Request Transform on the Target.

#viaApache
Using the "RequestHeader" directives Apache can add headers to outgoing request it forwards to the Target, when setup as ReverseProxy.
Here is the one I tested with:
------------
ProxyPass /viaApache/ http://vviswana-hpz2:9222/
ProxyPassReverse /viaApache/ http://vviswana-hpz2:9222/

<Location /viaApache >
#    RequestHeader add X-SSL_PROTOCOL "%{SSL_PROTOCOL}s"
#    RequestHeader add CAIssuer "%{SSL_CLIENT_I_DN}s"
#    RequestHeader add SerialNumber "%{SSL_CLIENT_S_DN}s"
#    RequestHeader add partial_SerialNumber "%{SSL_CLIENT_S_DN_CN}s"
#    RequestHeader add full_SerialNumber "%{SSL_CLIENT_S_DN}s"
RequestHeader add APIKey_Apache "dummyAPIKey-via-apache"
</Location>
--------------------
Please refer to Apache docs for more informatio on this.

Also attached is a sample debug enabled log showing the above options in play.

Note: The below command can be used to validate the stylesheet before testing on the engine:
java -cp C:/apix233/asg/2.3/lib/asg-functions.jar;C:/apix233/asg/2.3/lib/ext/tpcl/saxon9pe.jar;C:/apix233/asg/2.3/lib/ext/tpcl/json_simple-1.1.jar;C:/apix233/be/5.2/lib/ext/tibco/TIBCOxml.jar;C:/apix233/asg/2.3/lib/ext/tpcl/log4j-1.2.15.jar;C:/apix233/be/5.2/lib/ext/tpcl/apache/commons-lang3-3.3.2.jar;C:/apix233/be/5.2/lib/cep-common.jar;C:/apix233/be/5.2/lib/cep-kernel.jar;C:/apix233/asg/2.3/lib/ext/tpcl/merastring2base64.jar  com.tibco.be.functions.xml.XsltTransformer ./

Attachments

How to add extra HTTP Headers to the request sent to Target by API Exchange Gateway? get_app
How to add extra HTTP Headers to the request sent to Target by API Exchange Gateway? get_app
How to add extra HTTP Headers to the request sent to Target by API Exchange Gateway? get_app