diff --git a/groups/RODA/index.html b/groups/RODA/index.html
index 70bbaf5..5e38f45 100644
--- a/groups/RODA/index.html
+++ b/groups/RODA/index.html
@@ -76,7 +76,7 @@
window.APP_CONFIG = window.APP_CONFIG || {
debugLogs: false,
dashboardRuntimeFetch: 'always',
- dashboardApiUrl: 'api/dashboard',
+ dashboardApiUrl: 'https://proxykbk.netlify.app/.netlify/functions/dashboard',
};
diff --git a/groups/RODA/server.js b/groups/RODA/server.js
index 626f615..73dfe38 100644
--- a/groups/RODA/server.js
+++ b/groups/RODA/server.js
@@ -146,17 +146,30 @@ const server = http.createServer((req, res) => {
}
if (pathname === '/api/dashboard' || pathname === `${RODA_PATH_PREFIX}/api/dashboard`) {
+ if (req.method === 'OPTIONS') {
+ res.writeHead(204, {
+ 'Access-Control-Allow-Origin': '*',
+ 'Access-Control-Allow-Methods': 'GET',
+ });
+ res.end();
+ return;
+ }
+
fetchDashboardHtml()
.then(({ html, cached }) => {
res.writeHead(200, {
'Content-Type': 'text/html; charset=utf-8',
- 'X-Cache': cached
+ 'Access-Control-Allow-Origin': '*',
+ 'X-Cache': cached,
});
res.end(html);
})
.catch((error) => {
logServerError('api-dashboard', error);
- res.writeHead(502, { 'Content-Type': 'text/plain; charset=utf-8' });
+ res.writeHead(502, {
+ 'Content-Type': 'text/plain; charset=utf-8',
+ 'Access-Control-Allow-Origin': '*',
+ });
res.end('DASHBOARD_FETCH_FAILED');
});
return;