Skip to main content
Kofax

Cross Origin Resource Sharing (CORS) on KCM

3023671

Question / Problem: 

If ComposerUI for HTML5 is embedded in a web application that is hosted on another machine, then you will encounter cross origin resource sharing (CORS) problems.

Answer / Solution: 

Add the following to web.xml of Contract Manager and proxy both

Contract Manager:

C:\KCM\Programs\5.3\Contract Manager\webapps\ccm\WEB-INF\web.xml

Proxy:

C:\Program Files\Apache Software Foundation\Tomcat 9.0\instance-CCMRuntime-5.3\webapps-CM\proxy\web.xml

 

Note that in below config you must still replace * with the hostname of the page that embeds ComposerUI

    <param-name>cors.allowed.origins</param-name>

    <param-value>*</param-value>

To

    <param-name>cors.allowed.origins</param-name>

    <param-value>https://machineThatEmbedsComposerUI</param-value>

 

<filter>

  <filter-name>CorsFilter</filter-name>

  <filter-class>org.apache.catalina.filters.CorsFilter</filter-class>

  <init-param>

    <param-name>cors.allowed.origins</param-name>

    <param-value>*</param-value> <!-- CHANGE ME!!!!! -->

  </init-param>

  <init-param>

    <param-name>cors.allowed.methods</param-name>

    <param-value>GET,POST,HEAD,OPTIONS,PUT</param-value>

  </init-param>

  <init-param>

    <param-name>cors.allowed.headers</param-name>

    <param-value>Origin, Accept, X-Requested-With, Content-Type, Access-Control-Request-Method, Access-Control-Request-Headers</param-value>

  </init-param>

  <init-param>

    <param-name>cors.exposed.headers</param-name>

    <param-value>Access-Control-Allow-Origin</param-value>

  </init-param>

  <init-param>

    <param-name>cors.support.credentials</param-name>

    <param-value>true</param-value>

  </init-param>

  <init-param>

    <param-name>cors.preflight.maxage</param-name>

    <param-value>1800</param-value>

  </init-param>

</filter>

<filter-mapping>

  <filter-name>CorsFilter</filter-name>

  <url-pattern>/*</url-pattern>

</filter-mapping>

Applies to:  

Product Version
KCM all versions

 

 

  • Was this article helpful?