Accessing DHIS2 instance from an external app

Hello,

  We have a DHIS2 instance running on the server. We are testing another (external) javascript app and its access to this DHIS2 instance.

  When executing it locally on our PC we are getting an HTTP 0 error saying that a cross-domain resource was requested but no CORS headers in the response.

We’ve checked the DHIS2 setting for the CORS whitelist (https://docs.dhis2.org/2.28/en/user/html/system_access_settings.html ), but it is not clear what URL we should put if this external app is executing locally on our PC? Is there any workaround for this or we have to execute the app on the public URL that should be placed in the whitelist?

Thanks!

Best,

  Petar
···
_________________________________________________________________ Petar Jovanovic Department of Service and Information System Engineering (ESSI) Universitat Politècnica de Catalunya, BarcelonaTech Barcelona, Spain _____________ ___________________

http://www.essi.upc.edu/~petar/

Hi Petar,

what do you exactly mean with "executing it locally on our PC"?
I assume the app is running in the browser and the URL resembles
something like http://localhost:3000.
If that's the case, that is the address you need to add in the CORS
whitelist, it must include the port if any is used.

Hope this helps,

···

On Wed, Feb 28, 2018 at 11:00 AM, Petar Jovanovic <petar@essi.upc.edu> wrote:

Hello,

We have a DHIS2 instance running on the server. We are testing another
(external) javascript app and its access to this DHIS2 instance.

When executing it locally on our PC we are getting an HTTP 0 error saying
that a cross-domain resource was requested but no CORS headers in the
response.

We've checked the DHIS2 setting for the CORS whitelist
(https://docs.dhis2.org/2.28/en/user/html/system_access_settings.html), but
it is not clear what URL we should put if this external app is executing
locally on our PC? Is there any workaround for this or we have to execute
the app on the public URL that should be placed in the whitelist?

--
Edoardo Sabadelli
DHIS 2
University of Oslo
edoardo@dhis2.org
http://www.dhis2.org

Thank you very much!

I just meant that the external app is executing locally on our PC and trying to access the DHIS2 instance on a remote server.

Indeed, we were trying to do it with localhost adding a port (8080) but it did not work. Without the port, executing it in the browser seems to be working fine.

Best,
Petar

···

_________________________________________________________________
Petar Jovanovic
Department of Service and Information System Engineering (ESSI)
Universitat Politècnica de Catalunya, BarcelonaTech
Barcelona, Spain
_____________ http://www.essi.upc.edu/~petar/ ___________________

On 28-Feb-18 11:07 AM, Edoardo Sabadelli wrote:

On Wed, Feb 28, 2018 at 11:00 AM, Petar Jovanovic <petar@essi.upc.edu> wrote:

Hello,

We have a DHIS2 instance running on the server. We are testing another
(external) javascript app and its access to this DHIS2 instance.

When executing it locally on our PC we are getting an HTTP 0 error saying
that a cross-domain resource was requested but no CORS headers in the
response.

We've checked the DHIS2 setting for the CORS whitelist
(https://docs.dhis2.org/2.28/en/user/html/system_access_settings.html), but
it is not clear what URL we should put if this external app is executing
locally on our PC? Is there any workaround for this or we have to execute
the app on the public URL that should be placed in the whitelist?

Hi Petar,

what do you exactly mean with "executing it locally on our PC"?
I assume the app is running in the browser and the URL resembles
something like http://localhost:3000.
If that's the case, that is the address you need to add in the CORS
whitelist, it must include the port if any is used.

Hope this helps,