Next-generation platformDeprecated

Enabling CORS for local environment

If your application UI and the backend are on different hosts or hosted on different ports, you might encounter the Cross-Origin Resource Sharing (CORS) issue. To prevent this, you must enable the CORS filter on your local environments.

Procedure

Update your web.xml to contain the following entries for the CORS filter.
<filter>
        <filter-name>ISFCORSFilter</filter-name>
        <filter-class>com.ibm.isf.core.filters.ISFCORSFilter</filter-class>
        <init-param>
            <param-name>allowedOrigins</param-name>
            <param-value>*</param-value>
        </init-param>
        <init-param>
            <param-name>allowedMethods</param-name>
            <param-value>GET,POST</param-value>
        </init-param>
        <init-param>
            <param-name>allowCredentials</param-name>
            <param-value>true</param-value>
        </init-param>
    </filter>
    <filter-mapping>
        <filter-name>ISFCORSFilter</filter-name>
        <url-pattern>/*</url-pattern>
    </filter-mapping>
Note: This is applicable only for your local development and these changes in the web.xml must not be updated in your customization package and eventually in the cloud environments.