Mandatory Assignment 2
We recommend running a local instance of DHIS2 on your machine, as this will make general debugging easier, and also be helpful in the group project. Setting up your own local instance is not a requirement for the course and you can use demo instances if you do not want to deal with additional software on your machine.
You can also use one of the demo instances that DHIS2 provides for everyone to play around with.
Due to recent web browser security standard changes, connecting from a local development app to a remote server is blocked on most servers unless the server explicitly provides the correct CORS and SameSite cookie headers.
We can work around these security measures by manually modifying some browser settings such that the security measures are disabled. This, however, is obviously not optimal; security restrictions are there for our safety.
We can instead use a tool that runs on our local machine and
proxies all requests to
one of the demo servers. The
tool does exactly this; it
creates a proxy to a DHIS2 instance and makes a remote server seem
like a local instance.
Installation of the
dhis-portal tool is straight forward.
// yarnyarn global add dhis-portal// npmnpm install --global dhis-portal
We can then run the below command in our terminal
dhis-portal --server=play --instance=2.34.1
and a local web server will start running at the default port (9999)
that proxies all requests from
Server URL and credentials
When you run
yarn start inside your React project folder, you'll be
met with a login screen that asks for a server URL, username and
If you're running a local instance, your server URL is going to be (unless you modified any of the default values)
with the username
Demo instance using dhis-portal
dhis-portal tool by default runs the web server at port
so your server URL is going to be
with the username