The future Internet of Things (IoT) will consist of energy harvesting devices and Unmanned Aerial Vehicles (UAVs) to support applications in remote areas. However, as UAVs communicate with IoT devices using broadcast channels, information leakage emerges as a critical security threat. This paper considers the problem of maximizing the minimum secrecy rate in an energy harvesting IoT network supported by two UAVs, where one acts as a server to collect data from devices, and the other is an eavesdropper to intercept data transmission. It presents a novel Mixed-Integer Nonlinear Program (MINLP), which we then linearize into a Mixed-Integer Linear Program (MILP) problem. It also proposes a heuristic solution called Fly Nearest Location (FNL). Both solutions determine (i) the UAV server’s flight routing, flight time, and computation time, as well as (ii) the energy usage and operation mode of IoT devices. Our results show that FNL achieves on average 78.15% of MILP’s performance.