How to use DHIS2 Capture on a restricted network

Hello to all,
In order to control the use of the internet network and lower the internet bill, we have configured the firewall of our router. So only the connections to our instance dhis2 is allowed. This instance is on a cloud. Using the browsers, we can access our instance without any problem. Unfortunately we encounter difficulties with the Android application DHIS2 Capture. Indeed the application stays stuck on the loading page (the blue page). However, when we lift the restrictions on the router, the DHIS2 Capture application works correctly.
A small investigation allowed us to see that the DHIS2 Capture application connects to google and amazoneaws servers. We would like to understand the reasons for the difficulties with the DHIS2 Capture application when we apply restrictions on the router. Also we want to have the list of URLs to which the application connects in order to add them in the whitelist of our router.
Thank you for the solutions to solve our problems. Given the poor quality of the internet connection in our country, we would like to use the DHIS2 Capture application a lot.

Hi @Ckouassi

We ran some tests in the past and the application could be used without any problem in a limited network. However, I am running some test today and it seems that the new crash-reporting library might be blocking the logging in the app.

I will come back soon with some more information. In the meantime we could provide a list of hosts that you could enable in the firewall to let the users continue their work. Does your firewall support blocking by DNS or you would need a list of IP addresses?

Hello @jaime.bosque
we are interested in the list of hosts. Our firewall does a blocking with both modes. The ideal for us would be to couple the hostname to the IP address.
Given the urgency of setting up this device, we can use the list you have and then finalize the configuration later.

Hello again, @Ckouassi

I have been making some further tests, this time by a full network firewall and not an application firewall and I could operate the app as before. So my message yesterday was misleading and somehow wrong.

If in your firewall you allow connections only from the device to your server IP address the users should expect most of the application to work properly. You will be missing a couple of functionalities like maps (see below) and statistics/error reporting.

As it seems you were being blocked, can you describe the exact problem you are having? I guess you have set the rules in the firewall but the application cannot login. Can you try opening the same URL on the Android browser and see if the DHIS2 login page is displayed?

For the maps, this is the expected behavior as the map tiles, etc are not stored in the DHIS2 server but provided by an external tool i.e Mapbox. In case you need to allow the usage of maps you might follow this page: Working with firewalls | Help | Mapbox where it explains how to enable those (by domain) in your firewall.

Hello again @jaime.bosque,

We have just redone the tests with the version 2.4.3 of Dhis2 Capture, but it does not work properly. I explain again our problem.
We have set up a firewall on our router. We used the whitelist function in which we entered the url and public ip of our DHIS2 server. After activating the firewall, we have access to our DHIS2 server with browsers. We use browsers on Android devices (tablet, phone) and on computers. So we have access to all features of our dhis2 instance on this limited network with browsers.
However, we have difficulties using the android DHIS2 Capture application. With the DHIS2 Capture application, after entering the access details (url, username and password), the application gets stuck on the loading page (image attached).However the application works perfectly when we disable the firewall.

We want to get a list of hosts and/or IP addresses to add to the whitelist of our router in order to make the DHIS2 Capture application work. I specify that different versions of the application are installed on our Android devices. The version 2.33 of dhis2 is installed on our server

Hi @Ckouassi .

Yes, the behavior you are describing is what I had understood and there is no reason for your Application to not be working. It should connect and be able to work perfectly with some limitations: i.e maps and statistics not working but the main functionality of the app should remain.

I would recommend you doing the following:

With Flipper you should be able to see the HTTP requests that the application is performing. Are those URL the ones you have whitelisted on your firewall? I am assuming yes because you say you can access via the browser but just to be sure.

Look at this example of my workstation running flipper and Android emulator to read the HTTP calls:

Please try and let me know.

Hi @jaime.bosque,
I have followed the path you suggested but I can’t use flipper on my laptop with Windows 10.
I installed flipper, connected my tablet and launched flipper. Unfortunately flipper does not detect the tablet.
I have been trying for several days without success. Could you help me to use flipper? Video tutorials with step-by-step instructions would be a great help.

Hi @Ckouassi . Have you enabled developer mode in your tablet? Configure on-device developer options  |  Android Studio  |  Android Developers

Yes, I have enabled USB debugging

I guess you will need to install ADB as well… I am not really sure to be honest as I don’t use Windows. Can you see the device if you type in a terminal
adb devices

I did not install ADB, I install it then redo the tests.