mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-31 17:38:48 +00:00
Update ALFRESCOCORS.md
This commit is contained in:
@@ -4,21 +4,22 @@ The web client that we are building with the application development framework w
|
|||||||
So we need to tell the Alfresco server that any request that comes in from this custom web client should be allowed access
|
So we need to tell the Alfresco server that any request that comes in from this custom web client should be allowed access
|
||||||
to the Content Repository. This is done by enabling CORS.
|
to the Content Repository. This is done by enabling CORS.
|
||||||
|
|
||||||
To enable CORS in the Alfresco Platform do one of the following:
|
To enable CORS in the Alfresco Platform do **one of the following**:
|
||||||
|
|
||||||
**Download and install the enable CORS module**
|
##Recommended - Download and install the enable CORS module
|
||||||
|
|
||||||
This is the easiest way, add the [enablecors](https://artifacts.alfresco.com/nexus/service/local/repositories/releases/content/org/alfresco/enablecors/1.0/enablecors-1.0.jar)
|
This is the easiest way, add the [enablecors](https://artifacts.alfresco.com/nexus/service/local/repositories/releases/content/org/alfresco/enablecors/1.0/enablecors-1.0.jar)
|
||||||
platform module JAR to the *$ALF_INSTALL_DIR/modules/platform* directory and restart the server.
|
platform module JAR to the *$ALF_INSTALL_DIR/modules/platform* directory and restart the server.
|
||||||
|
|
||||||
Note. by default the CORS filter that is enabled will allow any orgin.
|
Note. by default the CORS filter that is enabled will allow any orgin.
|
||||||
|
|
||||||
**Manually update the web.xml file**
|
##Or - Manually update the web.xml file
|
||||||
|
|
||||||
Modify *$ALF_INSTALL_DIR/tomcat/webapps/alfresco/WEB-INF/web.xml* and uncomment the following section and update
|
Modify *$ALF_INSTALL_DIR/tomcat/webapps/alfresco/WEB-INF/web.xml* and uncomment the following section and update
|
||||||
`cors.allowOrigin` to `http://localhost:3000`:
|
`cors.allowOrigin` to `http://localhost:3000`:
|
||||||
|
|
||||||
```<filter>
|
```
|
||||||
|
<filter>
|
||||||
<filter-name>CORS</filter-name>
|
<filter-name>CORS</filter-name>
|
||||||
<filter-class>com.thetransactioncompany.cors.CORSFilter</filter-class>
|
<filter-class>com.thetransactioncompany.cors.CORSFilter</filter-class>
|
||||||
<init-param>
|
<init-param>
|
||||||
@@ -49,17 +50,18 @@ Modify *$ALF_INSTALL_DIR/tomcat/webapps/alfresco/WEB-INF/web.xml* and uncomment
|
|||||||
<param-name>cors.maxAge</param-name>
|
<param-name>cors.maxAge</param-name>
|
||||||
<param-value>3600</param-value>
|
<param-value>3600</param-value>
|
||||||
</init-param>
|
</init-param>
|
||||||
</filter>
|
</filter>
|
||||||
```
|
```
|
||||||
When specifying the `cors.allowOrigin` URL make sure to use the URL that will be used by the web client.
|
When specifying the `cors.allowOrigin` URL make sure to use the URL that will be used by the web client.
|
||||||
|
|
||||||
Then uncomment filter mappings:
|
Then uncomment filter mappings:
|
||||||
|
|
||||||
``` <filter-mapping>
|
```
|
||||||
|
<filter-mapping>
|
||||||
<filter-name>CORS</filter-name>
|
<filter-name>CORS</filter-name>
|
||||||
<url-pattern>/api/*</url-pattern>
|
<url-pattern>/api/*</url-pattern>
|
||||||
<url-pattern>/service/*</url-pattern>
|
<url-pattern>/service/*</url-pattern>
|
||||||
<url-pattern>/s/*</url-pattern>
|
<url-pattern>/s/*</url-pattern>
|
||||||
<url-pattern>/cmisbrowser/*</url-pattern>
|
<url-pattern>/cmisbrowser/*</url-pattern>
|
||||||
</filter-mapping>
|
</filter-mapping>
|
||||||
```
|
```
|
||||||
|
Reference in New Issue
Block a user