Our Work

How to enable CORS in Liferay 7

Updated 26 days ago

In this Article we will learn how to enable Liferay Cross Domain Access. Cross-origin resource sharing (CORS) is a mechanism that allows restricted resources on a web page to be requested from another domain outside the domain from which the first resource was served. To allow CORS in liferay we need to do few configuration changes and also we need to import few libraries.

  • Step 1: First download the below jars and keep in the tomcat lib

    • Cors-filter-2.6.jar

    • Java-property-utils-1.13.jar

  • Step 2: Then we need to add xml configuration to Liferay/tomcat/webapps/ROOT/WEB-INF/web.xml file

	<!-- Cors Filter  -->
       <!-- Update specific domains instead of giving to all -->
    	<param-value>accept, authorization, origin</param-value>
            	<param-value>GET, POST, HEAD, OPTIONS</param-value>
    	<!-- Cors Filter End -->
  • Step 3: After completion of above configuration, we need to restart liferay server.

KTree is the best offshore Liferay development company with extensive experience in Liferay Portal Development services alongwith Upgrade & Migration. Hire Liferay developers or Liferay development services from LiferayDeveloper.
KTree is one of top most Web Application Development company from India which specializes in Web Application development and Mobile Apps Development