Enabling Cross-Origin Resource Sharing(CORS) Filter Properties

TIBCO API Exchange Gateway can be configured to add servlet filters to its Tomcat engine. You can enable CORS by adding one or more CORS filter to the Tomcat server instance that runs the HTTP channels.

To add a CORS filter, set the following properties either in ASG_HOME/bin/asg_core.cdd file or in the ASG_HOME/bin/asg_engine.tra file:

The CDD file can be edited using:

  • Text editor
  • Studio

This section explains how to add the CORS filter properties in the asg_core.cdd file using a text editor.

Procedure

  1. Open the ASG_HOME/bin/asg_core.cdd file for editing in a text editor.
  2. Set the properties as follows:

    be.http.filter.cors.class=org.apache.catalina.filters.CorsFilter

    be.http.filter.cors.urlpattern.arbitraryUniqueName=urlPattern

    where,

    • cors identifies an instance of the filter. It is a non-empty string which should not contain a period (.) or an equal to (=) sign.
    • org.apache.catalina.filters.CorsFilter is the name of the class that implements the filter. For CORS, this must be org.apache.catalina.filters.CorsFilter
    • arbitraryUniqueName is a non-empty string chosen arbitrarily by the user.This is used to make the name of the property unique.
      • arbitraryUniqueName cannot contain the equal sign (=).
      • arbitraryUniqueName cannot be shared by multiple properties that have the same be.http.filter.filterName.urlpattern. prefix
    • urlPattern is the URL pattern that defines where the CORS filter is applied.
  3. Save the changes to the file.
    Note:
    • Properties start with be.http.filter.filterName where filterName is the filter name.
    • filterName cannot contain a period (.)
    • filterName is used both by TIBCO API Exchange Gateway and by Tomcat server to find all the declarations that apply to the same filter.
    • The type of Tomcat filter is defined by the value of the property be.http.filter.filterName.class