Setting Up CORS Filter in JIRA
This article only applies to the Confluence Gadget, installed on Confluence 8.x or earlier, not the newer Confluence Macro.
Sometimes Structure Gadget fails to load correctly in Confluence. You might see missing icons or the application can fail to work.
This may happen because of a known Jira issue that prevents the Structure gadget from loading resources from Jira when it's being served in Confluence on another web domain.
To work around this problem, you can set up a CORS filter in the Tomcat server that runs Jira (Nginx users may want to consider this alternative Nginx Configuration Option):
Copy cors-filter-2.4.jar, java-property-utils-1.9.1.jar from CORS docs to the /lib directory under Jira's installation folder.
Edit the file JIRA_INSTALL_DIR/atlassian-jira/WEB-INF/web.xml and add the following:
TEXT<!-- ==================== CORS configuration ====================== --> <filter> <filter-name>CORS</filter-name> <filter-class>com.thetransactioncompany.cors.CORSFilter</filter-class> <init-param> <param-name>cors.allowOrigin</param-name> <param-value>http://YOUR-CONFLUENCE-DOMAIN.com</param-value> <!-- use http: or https: depending on your configuration --> </init-param> <init-param> <param-name>cors.supportedMethods</param-name> <param-value>GET, POST, HEAD, OPTIONS, PUT, DELETE</param-value> </init-param> </filter> <filter-mapping> <filter-name>CORS</filter-name> <url-pattern>/*</url-pattern> </filter-mapping>
Restart Jira