cancel
Showing results for 
Search instead for 
Did you mean: 

[Android/iOS] Alfresco Mobile : Reverse proxy configuration

jm_pascal
Star Contributor
Star Contributor
Hello,

CMIS in Alfresco
As you may know, Alfresco Android Mobile uses CMIS protocol to retrieve informations and data from an Alfresco Repository.
Since Alfresco 4.x, Alfresco incorporate 2 implementations of CMIS. One historical based on Webscript (/service/cmis) and one based on Apache Chemistry OpenCMIS (/cmisatom). the historical is considered as deprecated for Alfresco 4.x and we encourage to use /cmisatom instead.
So depending on what version of Alfresco Repository you have, the Android Alfresco Mobile Application use one or the other implementation automatically.

This difference is illustrated when configuring an OnPremise Alfresco Server inside the Android Application.
At the bottom of the form, you have a "Service URL" input that contains by default /alfresco. It means the application is responsible to find and bind with a specific version.
For information, if you know the iOS application, the same input is defined by default with /alfresco/service/cmis.

Reverse Proxy
By default the local machine name is used as the host. When using a proxy these config values need to be changed to the publicly accessible host and port.

For Alfresco 3.4 : /service/cmis binding
CMIS retrieves the host and port to use for "links" from web script config. By default the local machine name is used as the host. When using a proxy these config values need to be changed to the publicly accessible host and port.

To do this add the following config…

<alfresco-config> 
   
   <config evaluator="string-compare" condition="Server">
      <server>
         <scheme>http</scheme>
         <hostname>your-pulic-host</hostname>
         <port>your-port</port>
         <path>alfresco</path>
      </server>
   </config>
   
</alfresco-config>

to a file in the following location:

<tomcat>/shared/classes/META-INF/spring-webscripts-config-custom.xml

For Alfresco 4.x and above : /cmisatom binding

CMIS retrieves the host and port to use for "links" from global-properties file.

To do this add the following config…

# The servlet path, context path and server can all be selectively overridden
opencmis.context.override=true
opencmis.context.value=
# if true, the servlet path of OpenCMIS generated urls will be set to "opencmis.servletpath.value", otherwise it will be taken from the request url
opencmis.servletpath.override=true
opencmis.servletpath.value=
opencmis.server.override=true
opencmis.server.value=https://<my.public.alfresco.hostname>

to a file in the following location:

<tomcat>/shared/classes/alfresco-global.properties

Hope it helps everyone !
6 REPLIES 6

loftux
Star Contributor
Star Contributor
I have only Share server (Alfresco repository is on separate server) exposed externally.
So how does config this apply to that scenario? Is there a way to have Share server act as cmis proxy to repository server? Should the service URL then be /share?

gavinc
Champ in-the-making
Champ in-the-making
Unfortunately, both the Android & iOS mobile apps communicate with the repository directly i.e. it is not possible to proxy the requests via Share.

It has also transpired that the configuration below will not help with a 4.x server. The /cmisatom binding in 4.x is actually using the server component from OpenCMIS (http://chemistry.apache.org) so the instructions detailed in this mailing list discussion (http://www.mail-archive.com/dev@chemistry.apache.org/msg01759.html) are applicable here too.

loftux
Star Contributor
Star Contributor
I tried with adding new remote endpoints to share-config-custom.xml
        <config evaluator="string-compare" condition="Remote">
                <remote>
                        <endpoint>
                                <id>cmisatom</id>
                                <name>Open CMIS</name>
                                <description>Open CMIS connector</description>
                                <connector-id>http</connector-id>
                                <endpoint-url>http://localhost:8080/alfresco/cmisatom</endpoint-url>
                                <basic-auth>true</basic-auth>
                                <identity>user</identity>
                        </endpoint>
                        <endpoint>
                                <id>service</id>
                                <name>Open CMIS</name>
                                <description>Open CMIS connector</description>
                                <connector-id>http</connector-id>
                                <endpoint-url>http://localhost:8080/alfresco/service</endpoint-url>
                                <basic-auth>true</basic-auth>
                                <identity>user</identity>
                        </endpoint>
                </remote>
        </config>
Then I use for Service URL: /share/proxy
I still get "An error occurred during session creation…", the tomcat access logs shows the initial steps working
127.0.0.1 - - [07/Dec/2012:16:36:29 +0100] "GET /alfresco/service/cmis HTTP/1.1" 200 33280
2.64.255.47 - - [07/Dec/2012:16:36:29 +0100] "GET /share/proxy/service/cmis HTTP/1.1" 200 33236
127.0.0.1 - - [07/Dec/2012:16:36:30 +0100] "GET /alfresco/service/cmis?repositoryId=6e38d51a-5ec7-40d6-9bbe-e1b44aea517d HTTP/1.1" 200 33280
2.64.255.47 - - [07/Dec/2012:16:36:30 +0100] "GET /share/proxy/service/cmis?repositoryId=6e38d51a-5ec7-40d6-9bbe-e1b44aea517d HTTP/1.1" 200 33236
127.0.0.1 - - [07/Dec/2012:16:36:30 +0100] "GET /alfresco/cmisatom/ HTTP/1.1" 200 28658
2.64.255.47 - - [07/Dec/2012:16:36:30 +0100] "GET /share/proxy/cmisatom HTTP/1.1" 200 28622
127.0.0.1 - - [07/Dec/2012:16:36:31 +0100] "GET /alfresco/cmisatom/?repositoryId=6e38d51a-5ec7-40d6-9bbe-e1b44aea517d HTTP/1.1" 200 28658
2.64.255.47 - - [07/Dec/2012:16:36:31 +0100] "GET /share/proxy/cmisatom?repositoryId=6e38d51a-5ec7-40d6-9bbe-e1b44aea517d HTTP/1.1" 200 28622

What do you think, can this be a possible way (with some additional config) to get share to act as proxy work?

gavinc
Champ in-the-making
Champ in-the-making
It's highly unlikely this route is going to fully work to be honest. It's not an environment/configuration we have tested and it's not something we're ever likely to support I'm afraid.

If you feel strongly that it should be supported I'd suggest raising this an improvement/enhancement in JIRA so product management can take it into consideration.

jonvargas
Confirmed Champ
Confirmed Champ
Hi JM Pascal,

Your hint did not work for me. Is it verified against 4.2.b/c versions? Ive just replaced the server URL, no servlet or context paths. Reverse proxy works fine using Share.

Thanks in advance.

gavinc
Champ in-the-making
Champ in-the-making
A solution/workaround is now available for configuring the Android app with an Apache proxy server.

The issue was originally raised as https://issues.alfresco.com/jira/browse/ALF-17109 so I have added details to the JIRA ticket.

I set this up on a 4.1.x server but the same approach should work on 4.2 community servers too.

Please let us know if this configuration does or doesn't work for you.