By default, cross domain requests are disabled in Apache web server. You need to set the Access-Control-Allow-Origin header to enable CORS (Cross Origin Resource Sharing) in Apache. Here are the steps to enable CORS in Apache web server. HAL INI DIPERLUKAN AGAR FILE BERFORMAT JSON DAPAT DIAKSES OLEH SERVER LAIN.
1. Enable headers module
$ sudo a2enmod headers
2. Enable CORS in Apache. Buat dan isi file .htaccess sbb:
...
Header add Access-Control-Allow-Origin "*"
...
3. Restart Apache Server
# apache2 -t
# systemctl restart apache2.service
4. Cek modul headers dengan perintah
# apache2ctl -M
Contoh yang diharapkan: