Unmanned Aerial Vehicles (UAVs) have been considered to have great potential in supporting reliable and timely data harvesting for Sensor Nodes (SNs) from an Internet of Things (IoT) perspective. However, due to physical limitations, UAVs are unable to further process the harvested data and have to rely on terrestrial servers, thus extra spectrum resource is needed to convey the harvested data. To avoid the cost of extra servers and spectrum resources, in this paper, we consider a UAV-based data harvesting network supported by a Cell-Free massive Multiple-Input-Multiple-Output (CF-mMIMO) system, where a UAV is used to collect and transmit data from SNs to the central processing unit of CF-mMIMO system for processing. In order to avoid using additional spectrum resources, the entire bandwidth is shared among radio access networks and wireless fronthaul links. Moreover, considering the limited capacity of the fronthaul links, the compress-and-forward scheme is adopted. In this work, in order to maximize the ergodically achievable sum rate of SNs, the power allocation of ground access points, the compression of fronthaul links, and also the bandwidth fraction between radio access networks and wireless fronthaul links are jointly optimized. To avoid the high overhead introduced by computing ergodically achievable rates, we introduce an approximate problem, using the large-dimensional random matrix theory, which relies only on statistical channel state information. We solve the nontrivial problem in three steps and propose an algorithm based on weighted minimum mean square error and Dinkelbach's methods to find solutions. Finally, simulation results show that the proposed algorithm converges quickly and outperforms the baseline algorithms.