ADF Login fail - Request has been terminated the network is offline, Origin is not allowed by Access-Control-Allow-Origin

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

ADF Login fail - Request has been terminated the network is offline, Origin is not allowed by Access-Control-Allow-Origin

Jump to solution

HI, i'm installed on a CentOS 7  remote machine with address ip "192.168.0.40"a Alfresco 5.2 community edition.

My alfresco machine run on standard port

https protocol on the port 8443 and http protocol on the port 8080

I have acces to the machine by a ssh connection where i made a forwarding for

https on the port 8444 and for the http on the port 8282

So now i use for example Share on the addresses:

https://localhost:8444/share and http://localhost:8282/share

or with the ip 127.0.0.1

https://127.0.0.1:8444 and  http://127.0.0.1:8282/share

Now i want to start  use the Angular 2 components of alfresco, and i start to follow this tutorial  ADF 101 - Getting Started with Alfresco Application Development Framework  and the documentation on the github project alfresco-ng2-components/demo-shell at master · Alfresco/alfresco-ng2-components · GitHub 

So these are my steps:

- Install a working Alfresco 5.2 Community and Share application (DONE)

- Add the following configuration settings to the alfresco-global.properties file.

cors.enabled=true
security.csrf.disabled=false

-  Enabling CORS on Alfresco ECM

Download the enablecors-1.0.jar from the Alfresco Nexus Repository. Below is described the link.
https://artifacts.alfresco.com/nexus/service/local/repositories/releases/content/org/alfresco/enable...
Save the enablecors-1.0.jar file in the $ALF_HOME/modules/platform folder.
Restart Alfresco.

- Installing REST API Explorer (Optional but DONE)

- Install the angular project on the client machine (not the remote machine 192.168.0.40)

git clone https://github.com/Alfresco/alfresco-ng2-components.git
cd alfresco-ng2-components/demo-shell

Modify the file " alfresco-ng2-components/demo-shell/src/app.config.json"

{
"$schema": "../../lib/core/app-config/schema.json",
"ecmHost": "http://localhost:8282",
"bpmHost": "http://localhost:9999", //NOT USED
"application": {
"name": "Alfresco ADF Application"
}
}

After that i run "npm install" and "npm run" and the application popup on the browser on the port 3000, but i can't figure out why i keep telling me the error:

"Request has been terminated Possible causes: the network is offline, Origin is not allowed by Access-Control-Allow-Origin, the page is being unloaded, etc."

I try everything to solve the issue but without any result .

After a while i read this topic https://community.alfresco.com/community/application-development-framework/blog/2017/06/20/adf-cors-... 

Modify the file " alfresco-ng2-components/demo-shell/src/app.config.json"

{
"$schema": "../../lib/core/app-config/schema.json",
"ecmHost": "http://localhost:3000/ecm",
"bpmHost": "http://localhost:3000/bpm", //NOT USED
"application": {
"name": "Alfresco ADF Application"
}
}

And modify the "alfresco-ng2-components/lib/config/webpack.common.js" by adding these piece of code:

    devServer: {
        contentBase: helpers.root('dist'),
        compress: true,
        port: 3000,
        historyApiFallback: true,
        host: '0.0.0.0',
        inline: true,
        proxy: {
            '/ecm': {
                target: {
                    host: "127.0.0.1" //"0.0.0.0", //127.0.0.1 for windows
                    protocol: 'http:',
                    port: 8282 //forwarded port
                },
                pathRewrite: {
                    '^/ecm': ''
                },
                secure: false,
                changeOrigin: true
            },
            '/ecm2': {
                target: {
                    host: "127.0.0.1" //"0.0.0.0", //127.0.0.1 for windows
                    protocol: 'https:',
                    port: 8444 //forwardedport
                },
                pathRewrite: {
                    '^/ecm2': ''
                },
                secure: false,
                changeOrigin: true
            },
            '/bpm': {
                target: {
                    host: "127.0.0.1" //"0.0.0.0", //127.0.0.1 for windows
                    protocol: 'http:',
                    port: 9999
                },
                pathRewrite: {
                    '^/bpm': ''
                },
                secure: false,
                changeOrigin: true
            }
        }
    },

Now i get another error : "Username and password unknows"

And now i'm stuck.

Anyone have succes to login with ADF on a Alfresco machine with SSH connection?

1 Solution

Accepted Solutions
Highlighted
Alfresco Employee

Re: ADF Login fail - Request has been terminated the network is offline, Origin is not allowed by Access-Control-Allow-Origin

Jump to solution

Alfresco 5.2 installer from Bitnami includes several issues. 

One of the most important is that they are not including modules from "modules/plaform" folder by default.

Check following file and content:

$ cat /opt/alfresco/tomcat/conf/Catalina/localhost/alfresco.xml
<?xml version='1.0' encoding='utf-8'?>
<Context crossContext="true">
<Loader className="org.apache.catalina.loader.VirtualWebappLoader"
  virtualClasspath="${catalina.base}/../modules/platform/*.jar" />
</Context>‍‍‍‍‍
Software Engineer in Alfresco Search Team.

View solution in original post

2 Replies
Highlighted
Alfresco Employee

Re: ADF Login fail - Request has been terminated the network is offline, Origin is not allowed by Access-Control-Allow-Origin

Jump to solution

Alfresco 5.2 installer from Bitnami includes several issues. 

One of the most important is that they are not including modules from "modules/plaform" folder by default.

Check following file and content:

$ cat /opt/alfresco/tomcat/conf/Catalina/localhost/alfresco.xml
<?xml version='1.0' encoding='utf-8'?>
<Context crossContext="true">
<Loader className="org.apache.catalina.loader.VirtualWebappLoader"
  virtualClasspath="${catalina.base}/../modules/platform/*.jar" />
</Context>‍‍‍‍‍
Software Engineer in Alfresco Search Team.

View solution in original post

Established Member II

Re: ADF Login fail - Request has been terminated the network is offline, Origin is not allowed by Access-Control-Allow-Origin

Jump to solution

Ty it was that and the fact i need to set the property:

security.csrf.disabled=true