How to configure CORS in ACS 6.2.2?

cancel
Showing results for 
Search instead for 
Did you mean: 
jmal
Member II

How to configure CORS in ACS 6.2.2?

Jump to solution

Hi, 

I have an instance of the Alfresco Content Services 6.2.2 (Enterprise).

I'm trying to configure CORS like in previous ACS versions.

As follows in web.xml: 

 

<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,http://myapp.example.com</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>
        <param-value>origin, authorization, x-file-size, x-file-name, content-type, accept, x-file-type, range</param-value>
    </init-param>
    <init-param>
        <param-name>cors.exposedHeaders</param-name>
        <param-value>Accept-Ranges, Content-Encoding, Content-Length, Content-Range</param-value>
    </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>

<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>
    <url-pattern>/definitions/*</url-pattern>
</filter-mapping>

 

In documentation (6.1) https://docs.alfresco.com/6.1/tasks/enable-cors.html but in https://docs.alfresco.com/6.2/concepts/welcome.html I can't find section about CORS configuration.

When I put it into my web.xml I got an exception while start ACS:

SEVERE: Exception starting filter [CORS]
java.lang.ClassNotFoundException: com.thetransactioncompany.cors.CORSFilter
	at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1358)
	at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1180)
	at org.apache.catalina.core.DefaultInstanceManager.loadClass(DefaultInstanceManager.java:545)
	at org.apache.catalina.core.DefaultInstanceManager.loadClassMaybePrivileged(DefaultInstanceManager.java:526)
	at org.apache.catalina.core.DefaultInstanceManager.newInstance(DefaultInstanceManager.java:150)
	at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:260)
	at org.apache.catalina.core.ApplicationFilterConfig.<init>(ApplicationFilterConfig.java:106)
	at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:4538)
	at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5181)
	at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)

Is possible to configure CORS in ACS 6.2.2? 

How to achieve this?

1 Solution

Accepted Solutions
angelborroy
Alfresco Employee

Re: How to configure CORS in ACS 6.2.2?

Jump to solution
3 Replies
angelborroy
Alfresco Employee

Re: How to configure CORS in ACS 6.2.2?

Jump to solution

Did you try this one?

https://docs.alfresco.com/6.2/concepts/enabling-cors.html

Hyland Developer Evangelist
jmal
Member II

Re: How to configure CORS in ACS 6.2.2?

Jump to solution

Thank you! I will try this one.

I didn't notice that the enabling-cors section had moved

EddieMay
Alfresco Employee

Re: How to configure CORS in ACS 6.2.2?

Jump to solution

Hi @jmal 

Great that you have a solution & thanks for updating us.

Cheers,

Digital Community Manager, Alfresco Software.
Problem solved? Click Accept as Solution!