...
/opt/alfresco/tomcat/webapps/alfresco/WEB-INF/libにcors-filter-1.9.3.jar,java-property-utils-1.9.1.jarが配置されていることを確認します。
Make sure "cors-filter-1.9.3.jar,java-property-utils-1.9.1.jar" were are located in "/opt/alfresco/tomcat/webapps/alfresco/WEB-INF/lib".
- /opt/alfresco/tomcat/webapps/alfresco/WEB-INF/web.xmlを編集します。
To Edit Edit /opt/alfresco/tomcat/webapps/alfresco/WEB-INF/web.xml
Uncomment the filter element that are commented at <!-- CORS Filter Begin → from<!-- CORS Filter End -->. <!-- CORS Filter Begin -->から<!-- CORS Filter End -->のコメント化されているfilter要素をコメント解除する。
Code Block <!-- CORS Filter Begin --> <filter> <filter-name>CORS</filter-name> <filter-class>com.thetransactioncompany.cors.CORSFilter</filter-class> <init-param> <param-name>cors.allowGenericHttpRequests</param-name> <param-value>true</param-value> </init-param> <init-param> <param-name>cors.allowOrigin</param-name> <param-value>http://localhost:8081</param-value> </init-param> <init-param> <param-name>cors.allowSubdomains</param-name> <param-value>true</param-value> </init-param> <init-param> <param-name>cors.supportedMethods</param-name> <param-value>GET, HEAD, POST, PUT, DELETE, OPTIONS</param-value> </init-param> <init-param> <param-name>cors.supportedHeaders</param-name> </init-param> <init-param> <param-name>cors.supportsCredentials</param-name> <param-value>true</param-value> </init-param> <init-param> <param-name>cors.maxAge</param-name> <param-value>3600</param-value> </init-param> </filter> <!-- CORS Filter End -->
Specify the URL to allow on the cross-domain to access "cros.allowOrigin" param-value of the init-param element.
init-param要素のcors.allowOriginパラメーターで指定されているURLにクロスドメインでのアクセスを許可するURLを指定する。
(ここではすべてのURLからのアクセスを許可する場合はアスタリスクとしていますが環境に応じて適切なURLを指定してください)
(Asterisk is specified here, but Please specify the appropriate URL.)( To allow all URL to access it specified asteriskThe following asterisk specify as permission to all URL, but please specify with appropriate URL which according to you your environment .)
Code Block <init-param> <param-name>cors.allowOrigin</param-name> <!--param-value>http://localhost:8081</param-value--> <param-value>*</param-value> </init-param>
<!-- CORS Filter Mappings Begin -->から<!-- CORS Filter Mappings End -->のコメント化されているfilter-mapping要素をコメント解除する。
Uncomment the filter-mapping elments that are commented at the<!-- CORS Filter Mappings Begin --> from <!-- CORS Filter Mappings End --> .
Code Block <!-- CORS Filter Mappings Begin --> <filter-mapping> <filter-name>CORS</filter-name> <url-pattern>/api/*</url-pattern> <url-pattern>/service/*</url-pattern> <url-pattern>/s/*</url-pattern> <url-pattern>/cmisbrowser/*</url-pattern> </filter-mapping> <!-- CORS Filter Mappings End -->
Alfrescoを再起動します。Restart the Alfresco.
...
cors-filter-2.4.jarとjava-property-utils-1.9.1.jarを/opt/alfresco/tomcat/webapps/alfresco/WEB-INF/libに配置します。
Put cors-filter-2.4.jar and java-property-utils-1.9.1.ja.in /opt/alfresco/tomcat/webapps/alfresco/WEB-INF/lib directory.
/opt/alfresco/tomcat/webapps/alfresco/WEB-INF/web.xmlを下記のように編集します。 Edit xmlを下記のように編集します。Edit 'web.xml' in '/opt/alfresco/tomcat/webapps/alfresco/WEB-INF/' as shown below.
Info <filter>要素のCORSはどこに設定しても問題は無し。
Set <filter>element, 'CORS' anywhere.
While, set <filter-mapping> between 'Global Localization Filter' and 'CMIS security context cleaning filter'.
ただし、<filter-mapping>はGlobal Localization Filterの後、CMIS security context cleaning filterの前にする必要があるそうです。
Code Block theme RDark <filter> <filter-name>JSF Session Synchronized Filter</filter-name> <filter-class>org.alfresco.repo.web.filter.beans.SessionSynchronizedFilter</filter-class> </filter> <!-- ここから追加 Add descriptions start --> <filter> <filter-name>CORS</filter-name> <filter-class>com.thetransactioncompany.cors.CORSFilter</filter-class> <init-param> <param-name>cors.allowOrigin</param-name> <param-value>*</param-value> </init-param> <init-param> <param-name>cors.allowSubdomains</param-name> <param-value>true</param-value> </init-param> <init-param> <param-name>cors.supportedMethods</param-name> <param-value>GET, POST, HEAD, PUT, DELETE, OPTIONS</param-value> </init-param> <init-param> <param-name>cors.supportedHeaders</param-name> <param-value>Content-Type, Accept, Authorization</param-value> </init-param> </filter> <!-- ここまで追加 Add descriptions end --> <filter-mapping> <filter-name>Global Localization Filter</filter-name> <url-pattern>/*</url-pattern> <dispatcher>REQUEST</dispatcher> </filter-mapping> <!-- ここから追加 Add descriptions start --> <filter-mapping> <filter-name>CORS</filter-name> <url-pattern>/api/*</url-pattern> <url-pattern>/service/*</url-pattern> <url-pattern>/s/*</url-pattern> <url-pattern>/cmisbrowser/*</url-pattern> </filter-mapping> <!-- ここまで追加 Add descriptions end --> <filter-mapping> <filter-name>CMIS security context cleaning filter</filter-name> <url-pattern>/cmisws/*</url-pattern> </filter-mapping>
Alfrescoを再起動します。 Reboot Restart the Alfresco.
Reference
About 'CORS'
...