Question

How do I set custom HTTP headers on an ESB proxy service Out Sequence? I'm trying to set "Access-Control-Allow-Origin" to allow my javascript/html front-end page to be able to GET the XML that is provided by this service. I also need to add a Cache-Control.

If there is a way to do this directly on my WSO2 Data Services Server (DSS), that would be preferable as it would avoid adding an ESB server to my process. According to this forum post from about a year ago, it's not possible: http://wso2.org/forum/thread/13991

I've tried it several ways, but looking at fiddler, the header is unchanged:

HTTP/1.1 200 OK
Content-Type: text/html;charset=ISO-8859-1
Content-Length: 637
Date: Wed, 28 Mar 2012 20:58:31 GMT
Server: WSO2 Carbon Server

I'm somewhat new with WSO2 servers (more of a front-end dev), so the answer could be right in front of me.

Was it helpful?

Solution

You can do this by adding a Property mediator to the out-sequence. Once you set the property with the transport scope there, it will be added to the transport header of the out going message from the ESB.

OTHER TIPS

This property mediator worked for me:

<property name="Access-Control-Allow-Origin" value="*" scope="transport" type="STRING"></property>

It allows access from any origin.

-Kari

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top