-
Notifications
You must be signed in to change notification settings - Fork 6
Working around CORS
William Zhou edited this page Sep 22, 2016
·
2 revisions
When you are creating a single page application (SPA) with JavaScript like Angular File Manager, you probably need to resolve the CORS issue between the SPA and REST server.
On Documentum REST Services 7.3
, we will provide a configuration to enable CORS on the REST server side.
# add in dctm-rest.war\WEB-INF\classes\rest-api-runtime.properties
rest.cors.enabled=true
However, for earlier versions, you need to find another way to address the CORS issue. This page describes an approach to address CORS with adhoc-cors-proxy.
- Assumed you have a Documentum REST Server deployed on remote port
http://10.37.14.217:8080/dctm-rest
. - Assumed you have started up Angular File Manager on local port
localhost:3000
.
- With
npm
, it's very easy to installadhoc-cors-proxy
by below command.
$ sudo npm install -g adhoc-cors-proxy
- Then map the remote REST server port to a local port on your host with
adhoc-cors-proxy
. It will create a light http server on your localhost. In this demo, we map the remote REST server port10.37.14.217:8080
to localhost port8089
.
$ corsproxy 10.37.14.217:8080 -p 8089 --credentials
- Now go back to the Angular File Manager app in you web browser,
http://localhost:3000
. Instead of inputing the remote REST server port in thesign-in
page, use your local porthttp://localhost:8089/dctm-rest
.
Here is the demo.
Learn more from GitHub · Documentum REST.