← Back to team overview

dhis2-devs team mailing list archive

CORS: accessing HTTP from HTTPS

 

Hi Devs

Sorry, I'm running into all kinds of issues with CORS today:

Mixed Content: The page at 'https://my-source-page.html' was loaded over
HTTPS, but requested an insecure XMLHttpRequest endpoint '
http://my-dhis2-analytics-call.json?etc'. This request has been blocked;
the content must be served over HTTPS.

Any suggestions for amending my ajax call below? I'm accessing http from
https, guessing my headers:need to be configured correctly:


 $.ajax({
url: base + dxAPI,
headers: { "Authorization": 'Basic ' + btoa(user + ':' + pwd) },
timeout: 30000,
crossDomain: true,
success : function(data){ ...etc

Works wonderfully from regular HTTP.

Regards,
Greg


-- 
*Health Information Systems Program - South Africa*
*- - - - - - - **- - - - - - - **- - - - - - - **- - - - - - - **- - - - - *
Mobile  :    073 246 2992
Landline:   021 851 2216
Skype:      gregory_rowles

Follow ups