Web portal CORS/preflight problem

Dear Experts

I am facing problem to creating Web Portal, facing problem CORS.
First I try portal from 103.247.238.68 not working and then put this address in the white list of the dhis2 server at 103.247.238.68:8080. But but still having the same problem the error message is ‘which is disallowed for cross-origin requests that require preflight’.

Now how I resolve this? The script is similar as on the developer guide, page 49.

Please advice.

Regards

Hannan

Hello Hanna,

Did you add http:// (or https:// if you use a secure line) in front of the IP address?

On the demo instance this is a bit confusing as the examples do not show that but it is required for it to work correctly.

Regards,

Mark

···

________________________________________
From: Dhis2-devs [dhis2-devs-bounces+markpo=ifi.uio.no@lists.launchpad.net] on behalf of Hannan Khan [hannank@gmail.com]
Sent: 27 August 2015 08:29
To: DHIS 2 developers
Subject: [Dhis2-devs] Web portal CORS/preflight problem

Dear Experts

I am facing problem to creating Web Portal, facing problem CORS.
First I try portal from 103.247.238.68 not working and then put this address in the white list of the dhis2 server at 103.247.238.68:8080<http://103.247.238.68:8080>. But but still having the same problem the error message is 'which is disallowed for cross-origin requests that require preflight'.

Now how I resolve this? The script is similar as on the developer guide, page 49.

Please advice.

Regards

Hannan

Dear Khan,

Look at this

http://api.jquery.com/jquery.ajax/

Read about crossDomain, by default it set to false so you may need to set it to true.

Ideally, in your ajax request, add crossDomain:true

Alex

···

On Thu, Aug 27, 2015 at 9:53 AM, Mark Polak markpo@ifi.uio.no wrote:

Hello Hanna,

Did you add http:// (or https:// if you use a secure line) in front of the IP address?

On the demo instance this is a bit confusing as the examples do not show that but it is required for it to work correctly.

Regards,

Mark


From: Dhis2-devs [dhis2-devs-bounces+markpo=ifi.uio.no@lists.launchpad.net] on behalf of Hannan Khan [hannank@gmail.com]

Sent: 27 August 2015 08:29

To: DHIS 2 developers

Subject: [Dhis2-devs] Web portal CORS/preflight problem

Dear Experts

I am facing problem to creating Web Portal, facing problem CORS.

First I try portal from 103.247.238.68 not working and then put this address in the white list of the dhis2 server at 103.247.238.68:8080<http://103.247.238.68:8080>. But but still having the same problem the error message is ‘which is disallowed for cross-origin requests that require preflight’.

Now how I resolve this? The script is similar as on the developer guide, page 49.

Please advice.

Regards

Hannan


Mailing list: https://launchpad.net/~dhis2-devs

Post to : dhis2-devs@lists.launchpad.net

Unsubscribe : https://launchpad.net/~dhis2-devs

More help : https://help.launchpad.net/ListHelp

Alex Tumwesigye

Technical Advisor - DHIS2 (Consultant),
Ministry of Health/AFENET

Kampala

Uganda

IT Consultant - BarefootPower Uganda Ltd, SmartSolar, Kenya

IT Specialist (Servers, Networks and Security, Health Information Systems - DHIS2 ) & Solar Consultant

+256 774149 775, + 256 759 800161

"I don’t want to be anything other than what I have been - one tree hill "

Dear Alex

Thank you for sharing the resources. but the problem still persists. i write as following:

Ext.onReady( function() {

Ext.Ajax.request({

crossDomain: true,

url: base + “dhis-web-commons-security/login.action?authOnly=true”,

method: ‘POST’,

Please check.

Regards

Hannan

···

On Thu, Aug 27, 2015 at 1:00 PM, Alex Tumwesigye atumwesigye@gmail.com wrote:

Dear Khan,

Look at this

http://api.jquery.com/jquery.ajax/

Read about crossDomain, by default it set to false so you may need to set it to true.

Ideally, in your ajax request, add crossDomain:true

Alex

On Thu, Aug 27, 2015 at 9:53 AM, Mark Polak markpo@ifi.uio.no wrote:

Hello Hanna,

Did you add http:// (or https:// if you use a secure line) in front of the IP address?

On the demo instance this is a bit confusing as the examples do not show that but it is required for it to work correctly.

Regards,

Mark


From: Dhis2-devs [dhis2-devs-bounces+markpo=ifi.uio.no@lists.launchpad.net] on behalf of Hannan Khan [hannank@gmail.com]

Sent: 27 August 2015 08:29

To: DHIS 2 developers

Subject: [Dhis2-devs] Web portal CORS/preflight problem

Dear Experts

I am facing problem to creating Web Portal, facing problem CORS.

First I try portal from 103.247.238.68 not working and then put this address in the white list of the dhis2 server at 103.247.238.68:8080<http://103.247.238.68:8080>. But but still having the same problem the error message is ‘which is disallowed for cross-origin requests that require preflight’.

Now how I resolve this? The script is similar as on the developer guide, page 49.

Please advice.

Regards

Hannan


Mailing list: https://launchpad.net/~dhis2-devs

Post to : dhis2-devs@lists.launchpad.net

Unsubscribe : https://launchpad.net/~dhis2-devs

More help : https://help.launchpad.net/ListHelp


Alex Tumwesigye

Technical Advisor - DHIS2 (Consultant),
Ministry of Health/AFENET

Kampala

Uganda

IT Consultant - BarefootPower Uganda Ltd, SmartSolar, Kenya

IT Specialist (Servers, Networks and Security, Health Information Systems - DHIS2 ) & Solar Consultant

+256 774149 775, + 256 759 800161

"I don’t want to be anything other than what I have been - one tree hill "

Hi Hannan

I haven’t used the portal plugins (maybe Jan can help there), but what I did when I implemented CORS for DHIS 2, was to simply test using this:

$.ajax({

url: ‘some-web-api-url.json’,

headers: { “Authorization”: btoa(‘admin:district’ }

}).done(…);

Also remember that there must be a 100% match between where your request is coming from, and what is in the whitelist, this also means that you must make the request from a http server, you can’t make just a index.html file and open it in a browser.

You can also enable a bit more debug output from your server by finding the file in web-commons called log4j.properties (in your unpacked WAR file) and add this line to the end:

log4j.logger.org.hisp.dhis.security.filter = DEBUG

···

On Thu, Aug 27, 2015 at 3:37 PM, Hannan Khan hannank@gmail.com wrote:

Dear Alex

Thank you for sharing the resources. but the problem still persists. i write as following:

Ext.onReady( function() {

Ext.Ajax.request({

crossDomain: true,

url: base + “dhis-web-commons-security/login.action?authOnly=true”,

method: ‘POST’,

Please check.

Regards

Hannan


Mailing list: https://launchpad.net/~dhis2-devs

Post to : dhis2-devs@lists.launchpad.net

Unsubscribe : https://launchpad.net/~dhis2-devs

More help : https://help.launchpad.net/ListHelp


Morten

On Thu, Aug 27, 2015 at 1:00 PM, Alex Tumwesigye atumwesigye@gmail.com wrote:

Dear Khan,

Look at this

http://api.jquery.com/jquery.ajax/

Read about crossDomain, by default it set to false so you may need to set it to true.

Ideally, in your ajax request, add crossDomain:true

Alex

On Thu, Aug 27, 2015 at 9:53 AM, Mark Polak markpo@ifi.uio.no wrote:

Hello Hanna,

Did you add http:// (or https:// if you use a secure line) in front of the IP address?

On the demo instance this is a bit confusing as the examples do not show that but it is required for it to work correctly.

Regards,

Mark


From: Dhis2-devs [dhis2-devs-bounces+markpo=ifi.uio.no@lists.launchpad.net] on behalf of Hannan Khan [hannank@gmail.com]

Sent: 27 August 2015 08:29

To: DHIS 2 developers

Subject: [Dhis2-devs] Web portal CORS/preflight problem

Dear Experts

I am facing problem to creating Web Portal, facing problem CORS.

First I try portal from 103.247.238.68 not working and then put this address in the white list of the dhis2 server at 103.247.238.68:8080<http://103.247.238.68:8080>. But but still having the same problem the error message is ‘which is disallowed for cross-origin requests that require preflight’.

Now how I resolve this? The script is similar as on the developer guide, page 49.

Please advice.

Regards

Hannan


Mailing list: https://launchpad.net/~dhis2-devs

Post to : dhis2-devs@lists.launchpad.net

Unsubscribe : https://launchpad.net/~dhis2-devs

More help : https://help.launchpad.net/ListHelp


Alex Tumwesigye

Technical Advisor - DHIS2 (Consultant),
Ministry of Health/AFENET

Kampala

Uganda

IT Consultant - BarefootPower Uganda Ltd, SmartSolar, Kenya

IT Specialist (Servers, Networks and Security, Health Information Systems - DHIS2 ) & Solar Consultant

+256 774149 775, + 256 759 800161

"I don’t want to be anything other than what I have been - one tree hill "

That should be headers: { "Authorization": 'Basic ' + btoa('admin:district'
}

···

On Thu, Aug 27, 2015 at 3:47 PM, Morten Olav Hansen <mortenoh@gmail.com> wrote:

  headers: { "Authorization": btoa('admin:district' }

--
Morten

Hi Hannan,

I have done some testing and it seems the bundled Ext version is getting old. CORS is not working well with it.

We need to look at this, but for now just include https://code.jquery.com/jquery-2.1.4.min.js (minified, only 84k) and do the authentication with jquery.

The good thing about CORS is that you can simply do a normal ajax request and the browser will take care of the rest.

···

On Thu, Aug 27, 2015 at 10:37 AM, Hannan Khan hannank@gmail.com wrote:

Dear Alex

Thank you for sharing the resources. but the problem still persists. i write as following:

Ext.onReady( function() {

Ext.Ajax.request({

crossDomain: true,

url: base + “dhis-web-commons-security/login.action?authOnly=true”,

method: ‘POST’,

Please check.

Regards

Hannan


Mailing list: https://launchpad.net/~dhis2-devs

Post to : dhis2-devs@lists.launchpad.net

Unsubscribe : https://launchpad.net/~dhis2-devs

More help : https://help.launchpad.net/ListHelp

On Thu, Aug 27, 2015 at 1:00 PM, Alex Tumwesigye atumwesigye@gmail.com wrote:

Dear Khan,

Look at this

http://api.jquery.com/jquery.ajax/

Read about crossDomain, by default it set to false so you may need to set it to true.

Ideally, in your ajax request, add crossDomain:true

Alex

On Thu, Aug 27, 2015 at 9:53 AM, Mark Polak markpo@ifi.uio.no wrote:

Hello Hanna,

Did you add http:// (or https:// if you use a secure line) in front of the IP address?

On the demo instance this is a bit confusing as the examples do not show that but it is required for it to work correctly.

Regards,

Mark


From: Dhis2-devs [dhis2-devs-bounces+markpo=ifi.uio.no@lists.launchpad.net] on behalf of Hannan Khan [hannank@gmail.com]

Sent: 27 August 2015 08:29

To: DHIS 2 developers

Subject: [Dhis2-devs] Web portal CORS/preflight problem

Dear Experts

I am facing problem to creating Web Portal, facing problem CORS.

First I try portal from 103.247.238.68 not working and then put this address in the white list of the dhis2 server at 103.247.238.68:8080<http://103.247.238.68:8080>. But but still having the same problem the error message is ‘which is disallowed for cross-origin requests that require preflight’.

Now how I resolve this? The script is similar as on the developer guide, page 49.

Please advice.

Regards

Hannan


Mailing list: https://launchpad.net/~dhis2-devs

Post to : dhis2-devs@lists.launchpad.net

Unsubscribe : https://launchpad.net/~dhis2-devs

More help : https://help.launchpad.net/ListHelp


Alex Tumwesigye

Technical Advisor - DHIS2 (Consultant),
Ministry of Health/AFENET

Kampala

Uganda

IT Consultant - BarefootPower Uganda Ltd, SmartSolar, Kenya

IT Specialist (Servers, Networks and Security, Health Information Systems - DHIS2 ) & Solar Consultant

+256 774149 775, + 256 759 800161

"I don’t want to be anything other than what I have been - one tree hill "

Thanks Jan.

I added in the but still I get the error. What did I do wrong?

Regards

Hannan

···

On Thu, Aug 27, 2015 at 2:49 PM, Jan Henrik Øverland janhenrik.overland@gmail.com wrote:

Hi Hannan,

I have done some testing and it seems the bundled Ext version is getting old. CORS is not working well with it.

We need to look at this, but for now just include https://code.jquery.com/jquery-2.1.4.min.js (minified, only 84k) and do the authentication with jquery.

The good thing about CORS is that you can simply do a normal ajax request and the browser will take care of the rest.

On Thu, Aug 27, 2015 at 10:37 AM, Hannan Khan hannank@gmail.com wrote:

Dear Alex

Thank you for sharing the resources. but the problem still persists. i write as following:

Ext.onReady( function() {

Ext.Ajax.request({

crossDomain: true,

url: base + “dhis-web-commons-security/login.action?authOnly=true”,

method: ‘POST’,

Please check.

Regards

Hannan


Mailing list: https://launchpad.net/~dhis2-devs

Post to : dhis2-devs@lists.launchpad.net

Unsubscribe : https://launchpad.net/~dhis2-devs

More help : https://help.launchpad.net/ListHelp

On Thu, Aug 27, 2015 at 1:00 PM, Alex Tumwesigye atumwesigye@gmail.com wrote:

Dear Khan,

Look at this

http://api.jquery.com/jquery.ajax/

Read about crossDomain, by default it set to false so you may need to set it to true.

Ideally, in your ajax request, add crossDomain:true

Alex

On Thu, Aug 27, 2015 at 9:53 AM, Mark Polak markpo@ifi.uio.no wrote:

Hello Hanna,

Did you add http:// (or https:// if you use a secure line) in front of the IP address?

On the demo instance this is a bit confusing as the examples do not show that but it is required for it to work correctly.

Regards,

Mark


From: Dhis2-devs [dhis2-devs-bounces+markpo=ifi.uio.no@lists.launchpad.net] on behalf of Hannan Khan [hannank@gmail.com]

Sent: 27 August 2015 08:29

To: DHIS 2 developers

Subject: [Dhis2-devs] Web portal CORS/preflight problem

Dear Experts

I am facing problem to creating Web Portal, facing problem CORS.

First I try portal from 103.247.238.68 not working and then put this address in the white list of the dhis2 server at 103.247.238.68:8080<http://103.247.238.68:8080>. But but still having the same problem the error message is ‘which is disallowed for cross-origin requests that require preflight’.

Now how I resolve this? The script is similar as on the developer guide, page 49.

Please advice.

Regards

Hannan


Mailing list: https://launchpad.net/~dhis2-devs

Post to : dhis2-devs@lists.launchpad.net

Unsubscribe : https://launchpad.net/~dhis2-devs

More help : https://help.launchpad.net/ListHelp


Alex Tumwesigye

Technical Advisor - DHIS2 (Consultant),
Ministry of Health/AFENET

Kampala

Uganda

IT Consultant - BarefootPower Uganda Ltd, SmartSolar, Kenya

IT Specialist (Servers, Networks and Security, Health Information Systems - DHIS2 ) & Solar Consultant

+256 774149 775, + 256 759 800161

"I don’t want to be anything other than what I have been - one tree hill "

Hi Hannan,

Did you leave out “https:” ?

···

On Thu, Aug 27, 2015 at 12:19 PM, Hannan Khan hannank@gmail.com wrote:

Thanks Jan.

I added in the but still I get the error. What did I do wrong?

Regards

Hannan


Mailing list: https://launchpad.net/~dhis2-devs

Post to : dhis2-devs@lists.launchpad.net

Unsubscribe : https://launchpad.net/~dhis2-devs

More help : https://help.launchpad.net/ListHelp

On Thu, Aug 27, 2015 at 2:49 PM, Jan Henrik Øverland janhenrik.overland@gmail.com wrote:

Hi Hannan,

I have done some testing and it seems the bundled Ext version is getting old. CORS is not working well with it.

We need to look at this, but for now just include https://code.jquery.com/jquery-2.1.4.min.js (minified, only 84k) and do the authentication with jquery.

The good thing about CORS is that you can simply do a normal ajax request and the browser will take care of the rest.

On Thu, Aug 27, 2015 at 10:37 AM, Hannan Khan hannank@gmail.com wrote:

Dear Alex

Thank you for sharing the resources. but the problem still persists. i write as following:

Ext.onReady( function() {

Ext.Ajax.request({

crossDomain: true,

url: base + “dhis-web-commons-security/login.action?authOnly=true”,

method: ‘POST’,

Please check.

Regards

Hannan


Mailing list: https://launchpad.net/~dhis2-devs

Post to : dhis2-devs@lists.launchpad.net

Unsubscribe : https://launchpad.net/~dhis2-devs

More help : https://help.launchpad.net/ListHelp

On Thu, Aug 27, 2015 at 1:00 PM, Alex Tumwesigye atumwesigye@gmail.com wrote:

Dear Khan,

Look at this

http://api.jquery.com/jquery.ajax/

Read about crossDomain, by default it set to false so you may need to set it to true.

Ideally, in your ajax request, add crossDomain:true

Alex

On Thu, Aug 27, 2015 at 9:53 AM, Mark Polak markpo@ifi.uio.no wrote:

Hello Hanna,

Did you add http:// (or https:// if you use a secure line) in front of the IP address?

On the demo instance this is a bit confusing as the examples do not show that but it is required for it to work correctly.

Regards,

Mark


From: Dhis2-devs [dhis2-devs-bounces+markpo=ifi.uio.no@lists.launchpad.net] on behalf of Hannan Khan [hannank@gmail.com]

Sent: 27 August 2015 08:29

To: DHIS 2 developers

Subject: [Dhis2-devs] Web portal CORS/preflight problem

Dear Experts

I am facing problem to creating Web Portal, facing problem CORS.

First I try portal from 103.247.238.68 not working and then put this address in the white list of the dhis2 server at 103.247.238.68:8080<http://103.247.238.68:8080>. But but still having the same problem the error message is ‘which is disallowed for cross-origin requests that require preflight’.

Now how I resolve this? The script is similar as on the developer guide, page 49.

Please advice.

Regards

Hannan


Mailing list: https://launchpad.net/~dhis2-devs

Post to : dhis2-devs@lists.launchpad.net

Unsubscribe : https://launchpad.net/~dhis2-devs

More help : https://help.launchpad.net/ListHelp


Alex Tumwesigye

Technical Advisor - DHIS2 (Consultant),
Ministry of Health/AFENET

Kampala

Uganda

IT Consultant - BarefootPower Uganda Ltd, SmartSolar, Kenya

IT Specialist (Servers, Networks and Security, Health Information Systems - DHIS2 ) & Solar Consultant

+256 774149 775, + 256 759 800161

"I don’t want to be anything other than what I have been - one tree hill "

Knut Staring

Dept. of Informatics, University of Oslo

Norway: +4791880522

Skype: knutstar

http://dhis2.org

You need to do this part

Ext.onReady( function() {

Ext.Ajax.request({

crossDomain: true,

url: base + “dhis-web-commons-security/login.action?authOnly=true”,

method: ‘POST’

with jquery instead of Ext.

See the code that Morten posted.

···

On Thu, Aug 27, 2015 at 12:19 PM, Hannan Khan hannank@gmail.com wrote:

Thanks Jan.

I added in the but still I get the error. What did I do wrong?

Regards

Hannan

On Thu, Aug 27, 2015 at 2:49 PM, Jan Henrik Øverland janhenrik.overland@gmail.com wrote:

Hi Hannan,

I have done some testing and it seems the bundled Ext version is getting old. CORS is not working well with it.

We need to look at this, but for now just include https://code.jquery.com/jquery-2.1.4.min.js (minified, only 84k) and do the authentication with jquery.

The good thing about CORS is that you can simply do a normal ajax request and the browser will take care of the rest.

On Thu, Aug 27, 2015 at 10:37 AM, Hannan Khan hannank@gmail.com wrote:

Dear Alex

Thank you for sharing the resources. but the problem still persists. i write as following:

Ext.onReady( function() {

Ext.Ajax.request({

crossDomain: true,

url: base + “dhis-web-commons-security/login.action?authOnly=true”,

method: ‘POST’,

Please check.

Regards

Hannan


Mailing list: https://launchpad.net/~dhis2-devs

Post to : dhis2-devs@lists.launchpad.net

Unsubscribe : https://launchpad.net/~dhis2-devs

More help : https://help.launchpad.net/ListHelp

On Thu, Aug 27, 2015 at 1:00 PM, Alex Tumwesigye atumwesigye@gmail.com wrote:

Dear Khan,

Look at this

http://api.jquery.com/jquery.ajax/

Read about crossDomain, by default it set to false so you may need to set it to true.

Ideally, in your ajax request, add crossDomain:true

Alex

On Thu, Aug 27, 2015 at 9:53 AM, Mark Polak markpo@ifi.uio.no wrote:

Hello Hanna,

Did you add http:// (or https:// if you use a secure line) in front of the IP address?

On the demo instance this is a bit confusing as the examples do not show that but it is required for it to work correctly.

Regards,

Mark


From: Dhis2-devs [dhis2-devs-bounces+markpo=ifi.uio.no@lists.launchpad.net] on behalf of Hannan Khan [hannank@gmail.com]

Sent: 27 August 2015 08:29

To: DHIS 2 developers

Subject: [Dhis2-devs] Web portal CORS/preflight problem

Dear Experts

I am facing problem to creating Web Portal, facing problem CORS.

First I try portal from 103.247.238.68 not working and then put this address in the white list of the dhis2 server at 103.247.238.68:8080<http://103.247.238.68:8080>. But but still having the same problem the error message is ‘which is disallowed for cross-origin requests that require preflight’.

Now how I resolve this? The script is similar as on the developer guide, page 49.

Please advice.

Regards

Hannan


Mailing list: https://launchpad.net/~dhis2-devs

Post to : dhis2-devs@lists.launchpad.net

Unsubscribe : https://launchpad.net/~dhis2-devs

More help : https://help.launchpad.net/ListHelp


Alex Tumwesigye

Technical Advisor - DHIS2 (Consultant),
Ministry of Health/AFENET

Kampala

Uganda

IT Consultant - BarefootPower Uganda Ltd, SmartSolar, Kenya

IT Specialist (Servers, Networks and Security, Health Information Systems - DHIS2 ) & Solar Consultant

+256 774149 775, + 256 759 800161

"I don’t want to be anything other than what I have been - one tree hill "

Dear Hannan,

Use $.ajax(…)

or replace crossDomain:y=true with cors:true

and try!

I have not used it but give it a try.

Alex

···

On Thu, Aug 27, 2015 at 1:24 PM, Jan Henrik Øverland janhenrik.overland@gmail.com wrote:

You need to do this part

Ext.onReady( function() {

Ext.Ajax.request({

crossDomain: true,

url: base + “dhis-web-commons-security/login.action?authOnly=true”,

method: ‘POST’

with jquery instead of Ext.

See the code that Morten posted.

On Thu, Aug 27, 2015 at 12:19 PM, Hannan Khan hannank@gmail.com wrote:

Thanks Jan.

I added in the but still I get the error. What did I do wrong?

Regards

Hannan

On Thu, Aug 27, 2015 at 2:49 PM, Jan Henrik Øverland janhenrik.overland@gmail.com wrote:

Hi Hannan,

I have done some testing and it seems the bundled Ext version is getting old. CORS is not working well with it.

We need to look at this, but for now just include https://code.jquery.com/jquery-2.1.4.min.js (minified, only 84k) and do the authentication with jquery.

The good thing about CORS is that you can simply do a normal ajax request and the browser will take care of the rest.

On Thu, Aug 27, 2015 at 10:37 AM, Hannan Khan hannank@gmail.com wrote:

Dear Alex

Thank you for sharing the resources. but the problem still persists. i write as following:

Ext.onReady( function() {

Ext.Ajax.request({

crossDomain: true,

url: base + “dhis-web-commons-security/login.action?authOnly=true”,

method: ‘POST’,

Please check.

Regards

Hannan


Mailing list: https://launchpad.net/~dhis2-devs

Post to : dhis2-devs@lists.launchpad.net

Unsubscribe : https://launchpad.net/~dhis2-devs

More help : https://help.launchpad.net/ListHelp

On Thu, Aug 27, 2015 at 1:00 PM, Alex Tumwesigye atumwesigye@gmail.com wrote:

Dear Khan,

Look at this

http://api.jquery.com/jquery.ajax/

Read about crossDomain, by default it set to false so you may need to set it to true.

Ideally, in your ajax request, add crossDomain:true

Alex

On Thu, Aug 27, 2015 at 9:53 AM, Mark Polak markpo@ifi.uio.no wrote:

Hello Hanna,

Did you add http:// (or https:// if you use a secure line) in front of the IP address?

On the demo instance this is a bit confusing as the examples do not show that but it is required for it to work correctly.

Regards,

Mark


From: Dhis2-devs [dhis2-devs-bounces+markpo=ifi.uio.no@lists.launchpad.net] on behalf of Hannan Khan [hannank@gmail.com]

Sent: 27 August 2015 08:29

To: DHIS 2 developers

Subject: [Dhis2-devs] Web portal CORS/preflight problem

Dear Experts

I am facing problem to creating Web Portal, facing problem CORS.

First I try portal from 103.247.238.68 not working and then put this address in the white list of the dhis2 server at 103.247.238.68:8080<http://103.247.238.68:8080>. But but still having the same problem the error message is ‘which is disallowed for cross-origin requests that require preflight’.

Now how I resolve this? The script is similar as on the developer guide, page 49.

Please advice.

Regards

Hannan


Mailing list: https://launchpad.net/~dhis2-devs

Post to : dhis2-devs@lists.launchpad.net

Unsubscribe : https://launchpad.net/~dhis2-devs

More help : https://help.launchpad.net/ListHelp


Alex Tumwesigye

Technical Advisor - DHIS2 (Consultant),
Ministry of Health/AFENET

Kampala

Uganda

IT Consultant - BarefootPower Uganda Ltd, SmartSolar, Kenya

IT Specialist (Servers, Networks and Security, Health Information Systems - DHIS2 ) & Solar Consultant

+256 774149 775, + 256 759 800161

"I don’t want to be anything other than what I have been - one tree hill "

Alex Tumwesigye

Technical Advisor - DHIS2 (Consultant),
Ministry of Health/AFENET

Kampala

Uganda

IT Consultant - BarefootPower Uganda Ltd, SmartSolar, Kenya

IT Specialist (Servers, Networks and Security, Health Information Systems - DHIS2 ) & Solar Consultant

+256 774149 775, + 256 759 800161

"I don’t want to be anything other than what I have been - one tree hill "

Dear Jan

I think cross domain problem is solved but more problem arise. I added the jquery js script line but there is no chart. I think as i use https://code.jquery.com/jquery-2.1.4.min.js’ the calling of chart might changed. the source I used is as :

DHIS2 Web Portal li { float: left; } .chart { border: 1px solid #ddd; margin: 10px; } .chart.wide { width: 800px; height: 450px; } .chart.tall { width: 600px; height: 920px; }

Data Visualizer Chart Plugin

This page illustrates the use of the Data Visualizer plugin which can be used to embed dynamic ExtJS charts into a Web page. You can embed charts pointing to pre-defined charts in DHIS, or select custom indicators, periods and org units to create dynamic charts. View the source of

this page to see how it is done.

Predefined charts

···

On Thu, Aug 27, 2015 at 4:24 PM, Jan Henrik Øverland janhenrik.overland@gmail.com wrote:

You need to do this part

Ext.onReady( function() {

Ext.Ajax.request({

crossDomain: true,

url: base + “dhis-web-commons-security/login.action?authOnly=true”,

method: ‘POST’

with jquery instead of Ext.

See the code that Morten posted.

On Thu, Aug 27, 2015 at 12:19 PM, Hannan Khan hannank@gmail.com wrote:

Thanks Jan.

I added in the but still I get the error. What did I do wrong?

Regards

Hannan

On Thu, Aug 27, 2015 at 2:49 PM, Jan Henrik Øverland janhenrik.overland@gmail.com wrote:

Hi Hannan,

I have done some testing and it seems the bundled Ext version is getting old. CORS is not working well with it.

We need to look at this, but for now just include https://code.jquery.com/jquery-2.1.4.min.js (minified, only 84k) and do the authentication with jquery.

The good thing about CORS is that you can simply do a normal ajax request and the browser will take care of the rest.

On Thu, Aug 27, 2015 at 10:37 AM, Hannan Khan hannank@gmail.com wrote:

Dear Alex

Thank you for sharing the resources. but the problem still persists. i write as following:

Ext.onReady( function() {

Ext.Ajax.request({

crossDomain: true,

url: base + “dhis-web-commons-security/login.action?authOnly=true”,

method: ‘POST’,

Please check.

Regards

Hannan


Mailing list: https://launchpad.net/~dhis2-devs

Post to : dhis2-devs@lists.launchpad.net

Unsubscribe : https://launchpad.net/~dhis2-devs

More help : https://help.launchpad.net/ListHelp

On Thu, Aug 27, 2015 at 1:00 PM, Alex Tumwesigye atumwesigye@gmail.com wrote:

Dear Khan,

Look at this

http://api.jquery.com/jquery.ajax/

Read about crossDomain, by default it set to false so you may need to set it to true.

Ideally, in your ajax request, add crossDomain:true

Alex

On Thu, Aug 27, 2015 at 9:53 AM, Mark Polak markpo@ifi.uio.no wrote:

Hello Hanna,

Did you add http:// (or https:// if you use a secure line) in front of the IP address?

On the demo instance this is a bit confusing as the examples do not show that but it is required for it to work correctly.

Regards,

Mark


From: Dhis2-devs [dhis2-devs-bounces+markpo=ifi.uio.no@lists.launchpad.net] on behalf of Hannan Khan [hannank@gmail.com]

Sent: 27 August 2015 08:29

To: DHIS 2 developers

Subject: [Dhis2-devs] Web portal CORS/preflight problem

Dear Experts

I am facing problem to creating Web Portal, facing problem CORS.

First I try portal from 103.247.238.68 not working and then put this address in the white list of the dhis2 server at 103.247.238.68:8080<http://103.247.238.68:8080>. But but still having the same problem the error message is ‘which is disallowed for cross-origin requests that require preflight’.

Now how I resolve this? The script is similar as on the developer guide, page 49.

Please advice.

Regards

Hannan


Mailing list: https://launchpad.net/~dhis2-devs

Post to : dhis2-devs@lists.launchpad.net

Unsubscribe : https://launchpad.net/~dhis2-devs

More help : https://help.launchpad.net/ListHelp


Alex Tumwesigye

Technical Advisor - DHIS2 (Consultant),
Ministry of Health/AFENET

Kampala

Uganda

IT Consultant - BarefootPower Uganda Ltd, SmartSolar, Kenya

IT Specialist (Servers, Networks and Security, Health Information Systems - DHIS2 ) & Solar Consultant

+256 774149 775, + 256 759 800161

"I don’t want to be anything other than what I have been - one tree hill "

Hi Hannan,

I am working on a fix for this. Any chance you can upgrade from 2.17?

···

On Sat, Aug 29, 2015 at 4:59 AM, Hannan Khan hannank@gmail.com wrote:

Dear Jan

I think cross domain problem is solved but more problem arise. I added the jquery js script line but there is no chart. I think as i use https://code.jquery.com/jquery-2.1.4.min.js’ the calling of chart might changed. the source I used is as :

DHIS2 Web Portal

li {

float: left;

}

.chart {

border: 1px solid #ddd;

margin: 10px;

}

.chart.wide {

width: 800px;

height: 450px;

}

.chart.tall {

width: 600px;

height: 920px;

}

Data Visualizer Chart Plugin

This page illustrates the use of the Data Visualizer plugin which can be used to embed dynamic ExtJS charts into a Web page. You can embed charts pointing to pre-defined charts in DHIS, or select custom indicators, periods and org units to create dynamic charts. View the source of

this page to see how it is done.

Predefined charts

  • On Thu, Aug 27, 2015 at 4:24 PM, Jan Henrik Øverland janhenrik.overland@gmail.com wrote:

    You need to do this part

    Ext.onReady( function() {

    Ext.Ajax.request({

    crossDomain: true,

    url: base + “dhis-web-commons-security/login.action?authOnly=true”,

    method: ‘POST’

    with jquery instead of Ext.

    See the code that Morten posted.

    On Thu, Aug 27, 2015 at 12:19 PM, Hannan Khan hannank@gmail.com wrote:

    Thanks Jan.

    I added in the but still I get the error. What did I do wrong?

    Regards

    Hannan

    On Thu, Aug 27, 2015 at 2:49 PM, Jan Henrik Øverland janhenrik.overland@gmail.com wrote:

    Hi Hannan,

    I have done some testing and it seems the bundled Ext version is getting old. CORS is not working well with it.

    We need to look at this, but for now just include https://code.jquery.com/jquery-2.1.4.min.js (minified, only 84k) and do the authentication with jquery.

    The good thing about CORS is that you can simply do a normal ajax request and the browser will take care of the rest.

    On Thu, Aug 27, 2015 at 10:37 AM, Hannan Khan hannank@gmail.com wrote:

    Dear Alex

    Thank you for sharing the resources. but the problem still persists. i write as following:

    Ext.onReady( function() {

    Ext.Ajax.request({

    crossDomain: true,

    url: base + “dhis-web-commons-security/login.action?authOnly=true”,

    method: ‘POST’,

    Please check.

    Regards

    Hannan


    Mailing list: https://launchpad.net/~dhis2-devs

    Post to : dhis2-devs@lists.launchpad.net

    Unsubscribe : https://launchpad.net/~dhis2-devs

    More help : https://help.launchpad.net/ListHelp

    On Thu, Aug 27, 2015 at 1:00 PM, Alex Tumwesigye atumwesigye@gmail.com wrote:

    Dear Khan,

    Look at this

    http://api.jquery.com/jquery.ajax/

    Read about crossDomain, by default it set to false so you may need to set it to true.

    Ideally, in your ajax request, add crossDomain:true

    Alex

    On Thu, Aug 27, 2015 at 9:53 AM, Mark Polak markpo@ifi.uio.no wrote:

    Hello Hanna,

    Did you add http:// (or https:// if you use a secure line) in front of the IP address?

    On the demo instance this is a bit confusing as the examples do not show that but it is required for it to work correctly.

    Regards,

    Mark


    From: Dhis2-devs [dhis2-devs-bounces+markpo=ifi.uio.no@lists.launchpad.net] on behalf of Hannan Khan [hannank@gmail.com]

    Sent: 27 August 2015 08:29

    To: DHIS 2 developers

    Subject: [Dhis2-devs] Web portal CORS/preflight problem

    Dear Experts

    I am facing problem to creating Web Portal, facing problem CORS.

    First I try portal from 103.247.238.68 not working and then put this address in the white list of the dhis2 server at 103.247.238.68:8080<http://103.247.238.68:8080>. But but still having the same problem the error message is ‘which is disallowed for cross-origin requests that require preflight’.

    Now how I resolve this? The script is similar as on the developer guide, page 49.

    Please advice.

    Regards

    Hannan


    Mailing list: https://launchpad.net/~dhis2-devs

    Post to : dhis2-devs@lists.launchpad.net

    Unsubscribe : https://launchpad.net/~dhis2-devs

    More help : https://help.launchpad.net/ListHelp


    Alex Tumwesigye

    Technical Advisor - DHIS2 (Consultant),
    Ministry of Health/AFENET

    Kampala

    Uganda

    IT Consultant - BarefootPower Uganda Ltd, SmartSolar, Kenya

    IT Specialist (Servers, Networks and Security, Health Information Systems - DHIS2 ) & Solar Consultant

    +256 774149 775, + 256 759 800161

    "I don’t want to be anything other than what I have been - one tree hill "

    Dear Jan

    Thanks. Delight to know that; I am waiting.

    We already upgraded to version 2.19. We are also upgrading tracker system to 2.19. I will than do the portal and integration of servers and synchronization of reporting server. I will be in touch.

    Best regards

    Hannan

    ···

    On Mon, Sep 7, 2015 at 5:38 PM, Jan Henrik Øverland janhenrik.overland@gmail.com wrote:

    Hi Hannan,

    I am working on a fix for this. Any chance you can upgrade from 2.17?

    On Sat, Aug 29, 2015 at 4:59 AM, Hannan Khan hannank@gmail.com wrote:

    Dear Jan

    I think cross domain problem is solved but more problem arise. I added the jquery js script line but there is no chart. I think as i use https://code.jquery.com/jquery-2.1.4.min.js’ the calling of chart might changed. the source I used is as :

    DHIS2 Web Portal

    li {

    float: left;

    }

    .chart {

    border: 1px solid #ddd;

    margin: 10px;

    }

    .chart.wide {

    width: 800px;

    height: 450px;

    }

    .chart.tall {

    width: 600px;

    height: 920px;

    }

    Data Visualizer Chart Plugin

    This page illustrates the use of the Data Visualizer plugin which can be used to embed dynamic ExtJS charts into a Web page. You can embed charts pointing to pre-defined charts in DHIS, or select custom indicators, periods and org units to create dynamic charts. View the source of

    this page to see how it is done.

    Predefined charts

  • On Thu, Aug 27, 2015 at 4:24 PM, Jan Henrik Øverland janhenrik.overland@gmail.com wrote:

    You need to do this part

    Ext.onReady( function() {

    Ext.Ajax.request({

    crossDomain: true,

    url: base + “dhis-web-commons-security/login.action?authOnly=true”,

    method: ‘POST’

    with jquery instead of Ext.

    See the code that Morten posted.

    On Thu, Aug 27, 2015 at 12:19 PM, Hannan Khan hannank@gmail.com wrote:

    Thanks Jan.

    I added in the but still I get the error. What did I do wrong?

    Regards

    Hannan

    On Thu, Aug 27, 2015 at 2:49 PM, Jan Henrik Øverland janhenrik.overland@gmail.com wrote:

    Hi Hannan,

    I have done some testing and it seems the bundled Ext version is getting old. CORS is not working well with it.

    We need to look at this, but for now just include https://code.jquery.com/jquery-2.1.4.min.js (minified, only 84k) and do the authentication with jquery.

    The good thing about CORS is that you can simply do a normal ajax request and the browser will take care of the rest.

    On Thu, Aug 27, 2015 at 10:37 AM, Hannan Khan hannank@gmail.com wrote:

    Dear Alex

    Thank you for sharing the resources. but the problem still persists. i write as following:

    Ext.onReady( function() {

    Ext.Ajax.request({

    crossDomain: true,

    url: base + “dhis-web-commons-security/login.action?authOnly=true”,

    method: ‘POST’,

    Please check.

    Regards

    Hannan


    Mailing list: https://launchpad.net/~dhis2-devs

    Post to : dhis2-devs@lists.launchpad.net

    Unsubscribe : https://launchpad.net/~dhis2-devs

    More help : https://help.launchpad.net/ListHelp

    On Thu, Aug 27, 2015 at 1:00 PM, Alex Tumwesigye atumwesigye@gmail.com wrote:

    Dear Khan,

    Look at this

    http://api.jquery.com/jquery.ajax/

    Read about crossDomain, by default it set to false so you may need to set it to true.

    Ideally, in your ajax request, add crossDomain:true

    Alex

    On Thu, Aug 27, 2015 at 9:53 AM, Mark Polak markpo@ifi.uio.no wrote:

    Hello Hanna,

    Did you add http:// (or https:// if you use a secure line) in front of the IP address?

    On the demo instance this is a bit confusing as the examples do not show that but it is required for it to work correctly.

    Regards,

    Mark


    From: Dhis2-devs [dhis2-devs-bounces+markpo=ifi.uio.no@lists.launchpad.net] on behalf of Hannan Khan [hannank@gmail.com]

    Sent: 27 August 2015 08:29

    To: DHIS 2 developers

    Subject: [Dhis2-devs] Web portal CORS/preflight problem

    Dear Experts

    I am facing problem to creating Web Portal, facing problem CORS.

    First I try portal from 103.247.238.68 not working and then put this address in the white list of the dhis2 server at 103.247.238.68:8080<http://103.247.238.68:8080>. But but still having the same problem the error message is ‘which is disallowed for cross-origin requests that require preflight’.

    Now how I resolve this? The script is similar as on the developer guide, page 49.

    Please advice.

    Regards

    Hannan


    Mailing list: https://launchpad.net/~dhis2-devs

    Post to : dhis2-devs@lists.launchpad.net

    Unsubscribe : https://launchpad.net/~dhis2-devs

    More help : https://help.launchpad.net/ListHelp


    Alex Tumwesigye

    Technical Advisor - DHIS2 (Consultant),
    Ministry of Health/AFENET

    Kampala

    Uganda

    IT Consultant - BarefootPower Uganda Ltd, SmartSolar, Kenya

    IT Specialist (Servers, Networks and Security, Health Information Systems - DHIS2 ) & Solar Consultant

    +256 774149 775, + 256 759 800161

    "I don’t want to be anything other than what I have been - one tree hill "

    Ok, I will try to backport when I’m done.

    ···

    On Mon, Sep 7, 2015 at 3:02 PM, Hannan Khan hannank@gmail.com wrote:

    Dear Jan

    Thanks. Delight to know that; I am waiting.

    We already upgraded to version 2.19. We are also upgrading tracker system to 2.19. I will than do the portal and integration of servers and synchronization of reporting server. I will be in touch.

    Best regards

    Hannan

    On Mon, Sep 7, 2015 at 5:38 PM, Jan Henrik Øverland janhenrik.overland@gmail.com wrote:

    Hi Hannan,

    I am working on a fix for this. Any chance you can upgrade from 2.17?

    On Sat, Aug 29, 2015 at 4:59 AM, Hannan Khan hannank@gmail.com wrote:

    Dear Jan

    I think cross domain problem is solved but more problem arise. I added the jquery js script line but there is no chart. I think as i use https://code.jquery.com/jquery-2.1.4.min.js’ the calling of chart might changed. the source I used is as :

    DHIS2 Web Portal

    li {

    float: left;

    }

    .chart {

    border: 1px solid #ddd;

    margin: 10px;

    }

    .chart.wide {

    width: 800px;

    height: 450px;

    }

    .chart.tall {

    width: 600px;

    height: 920px;

    }

    Data Visualizer Chart Plugin

    This page illustrates the use of the Data Visualizer plugin which can be used to embed dynamic ExtJS charts into a Web page. You can embed charts pointing to pre-defined charts in DHIS, or select custom indicators, periods and org units to create dynamic charts. View the source of

    this page to see how it is done.

    Predefined charts

  • On Thu, Aug 27, 2015 at 4:24 PM, Jan Henrik Øverland janhenrik.overland@gmail.com wrote:

    You need to do this part

    Ext.onReady( function() {

    Ext.Ajax.request({

    crossDomain: true,

    url: base + “dhis-web-commons-security/login.action?authOnly=true”,

    method: ‘POST’

    with jquery instead of Ext.

    See the code that Morten posted.

    On Thu, Aug 27, 2015 at 12:19 PM, Hannan Khan hannank@gmail.com wrote:

    Thanks Jan.

    I added in the but still I get the error. What did I do wrong?

    Regards

    Hannan

    On Thu, Aug 27, 2015 at 2:49 PM, Jan Henrik Øverland janhenrik.overland@gmail.com wrote:

    Hi Hannan,

    I have done some testing and it seems the bundled Ext version is getting old. CORS is not working well with it.

    We need to look at this, but for now just include https://code.jquery.com/jquery-2.1.4.min.js (minified, only 84k) and do the authentication with jquery.

    The good thing about CORS is that you can simply do a normal ajax request and the browser will take care of the rest.

    On Thu, Aug 27, 2015 at 10:37 AM, Hannan Khan hannank@gmail.com wrote:

    Dear Alex

    Thank you for sharing the resources. but the problem still persists. i write as following:

    Ext.onReady( function() {

    Ext.Ajax.request({

    crossDomain: true,

    url: base + “dhis-web-commons-security/login.action?authOnly=true”,

    method: ‘POST’,

    Please check.

    Regards

    Hannan


    Mailing list: https://launchpad.net/~dhis2-devs

    Post to : dhis2-devs@lists.launchpad.net

    Unsubscribe : https://launchpad.net/~dhis2-devs

    More help : https://help.launchpad.net/ListHelp

    On Thu, Aug 27, 2015 at 1:00 PM, Alex Tumwesigye atumwesigye@gmail.com wrote:

    Dear Khan,

    Look at this

    http://api.jquery.com/jquery.ajax/

    Read about crossDomain, by default it set to false so you may need to set it to true.

    Ideally, in your ajax request, add crossDomain:true

    Alex

    On Thu, Aug 27, 2015 at 9:53 AM, Mark Polak markpo@ifi.uio.no wrote:

    Hello Hanna,

    Did you add http:// (or https:// if you use a secure line) in front of the IP address?

    On the demo instance this is a bit confusing as the examples do not show that but it is required for it to work correctly.

    Regards,

    Mark


    From: Dhis2-devs [dhis2-devs-bounces+markpo=ifi.uio.no@lists.launchpad.net] on behalf of Hannan Khan [hannank@gmail.com]

    Sent: 27 August 2015 08:29

    To: DHIS 2 developers

    Subject: [Dhis2-devs] Web portal CORS/preflight problem

    Dear Experts

    I am facing problem to creating Web Portal, facing problem CORS.

    First I try portal from 103.247.238.68 not working and then put this address in the white list of the dhis2 server at 103.247.238.68:8080<http://103.247.238.68:8080>. But but still having the same problem the error message is ‘which is disallowed for cross-origin requests that require preflight’.

    Now how I resolve this? The script is similar as on the developer guide, page 49.

    Please advice.

    Regards

    Hannan


    Mailing list: https://launchpad.net/~dhis2-devs

    Post to : dhis2-devs@lists.launchpad.net

    Unsubscribe : https://launchpad.net/~dhis2-devs

    More help : https://help.launchpad.net/ListHelp


    Alex Tumwesigye

    Technical Advisor - DHIS2 (Consultant),
    Ministry of Health/AFENET

    Kampala

    Uganda

    IT Consultant - BarefootPower Uganda Ltd, SmartSolar, Kenya

    IT Specialist (Servers, Networks and Security, Health Information Systems - DHIS2 ) & Solar Consultant

    +256 774149 775, + 256 759 800161

    "I don’t want to be anything other than what I have been - one tree hill "