Our Work

How to enable CORS in Liferay 7

Updated today

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.

Looking for Liferay Developer?

KTree is the best offshore Liferay development company with extensive experience in Liferay Portal Development services along with Upgrade & Migration. Hire Liferay developers or Liferay development services from LiferayDeveloper.

Request For Quote