Cross Origin Resource Sharing (CORS) on KCM
Issue
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.
Solution
Add the following to web.xml of Contract Manager and proxy both
Contract Manager:
C:\KCM\Programs\<version>\Contract Manager\webapps\ccm\WEB-INF\web.xml
Proxy (5.4 and earlier):
C:\Program Files\Apache Software Foundation\Tomcat 9.0\instance-CCMRuntime-<version>\webapps-CM\proxy\WEB-INF\web.xml
Proxy (5.5 and later):
C:\Program Files\Apache Software Foundation\Tomcat 9.0\instance-KCMRuntime-<version>\webapps\proxy\WEB-INF\web.xml
Note that in below config you must still replace * with the hostname of the server that embeds ComposerUI
In the below example (below "Add the following:") change:
<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>
Add the following:
<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>
Level of Complexity
High
Applies to
Product | Version | Build | Environment | Hardware |
---|---|---|---|---|
Kofax Communications Manager | 4.4 and newer | n/a | n/a | n/a |
Article # 3035699