Afegir opciĆ³ per establir la capƧalera Access-Control-Allow-Origin

Change-Id: I44b50336989c91fd054615978dc9c59ebef513a3
diff --git a/config.default.php b/config.default.php
index 7a5af80..5c92950 100644
--- a/config.default.php
+++ b/config.default.php
@@ -28,4 +28,8 @@
 
 // Lloc on s'allotja el web (frontend)
 //   Exemple: https://covid.fme.upc.edu/
-$conf['homeUrl'] = '';
+$conf['frontendUrl'] = '';
+
+// Valor del header Access-Control-Allow-Origin per les peticions a l'API.
+// Per defecte és el valor de la variable $conf['homeUrl']
+$conf['allowedOrigin'] = $conf['homeUrl'];
diff --git a/inc/API.php b/inc/API.php
index 0d5530e..ccc2c94 100644
--- a/inc/API.php
+++ b/inc/API.php
@@ -39,8 +39,8 @@
 
     header('Content-Type: application/json');
 
-    if (isset($conf['frontendUrl']) && !empty($conf['frontendUrl']))
-      header('Access-Control-Allow-Origin: '.$conf['frontendUrl']);
+    if (isset($conf['allowedOrigin']) && !empty($conf['allowedOrigin']))
+      header('Access-Control-Allow-Origin: '.$conf['allowedOrigin']);
 
     $parts = explode('/', $path);
     $method = $parts[0] ?? '';