Six Stars

Adding custom http headers to tRESTResponse

Is it possible to add custom http headers to a tRESTResponse? I know that there is an enhancement request for doing this and it is still not in progress of being worked on (https://jira.talendforge.org/browse/TESB-6057). I would need this so that I can implement CORS. I do not wish to use JSONP since it would require more logic and be more of a "work-around".
Could I add http headers using tGroovy or tJavaFlex?
3 REPLIES
Six Stars

Re: Adding custom http headers to tRESTResponse

This enhancement has been implemented in version 5.2. See tRESTResponse/Advanced Settings to add manual http headers.
For CORS, just add the http header "Access-Control-Allow-Origin" with the value "*" to the tRESRResponse component.
One Star

Re: Adding custom http headers to tRESTResponse

Dear Talend ESB Team,
Using last version of 5.6 in component TRestResponse and adding "Access-Control-Allow-Origin" with the value "*" , we still are getting the same CORS problem.
Do you know why header is not seen at http response?
 
One Star

Re: Adding custom http headers to tRESTResponse

We restarted Runtime ESB and it worked.