# CORS problems in GenieACS-NBI (temporary solution found)

**URL:** <https://forum.genieacs.com/t/cors-problems-in-genieacs-nbi-temporary-solution-found/603>\
**Category:** Uncategorized\
**Created:** [February 11, 2020, 10:14pm UTC](https://forum.genieacs.com/t/cors-problems-in-genieacs-nbi-temporary-solution-found/603 "2020-02-11T22:14:46Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Dennyfentow](https://yyz1.discourse-cdn.com/flex035/user_avatar/forum.genieacs.com/dennyfentow/32/170_2.png) [@Dennyfentow](https://forum.genieacs.com/u/Dennyfentow)\
**Post date:** [February 11, 2020, 10:14pm UTC](https://forum.genieacs.com/t/cors-problems-in-genieacs-nbi-temporary-solution-found/603/1 "2020-02-11T22:14:46Z")

</div>

Hello everyone, I encountered a problem when trying to use the GenieACS API which would be about CORS (Cross-Origin Resource Sharing) requests, browsers simply block requests coming from unknown sources. As I am new to Node JS, I was not able to change directly in the code, I was only able to change directly in the file present in `"/opt/genieacs/dist/bin/genieacs-nbi"` (Docker image). In this file, I inserted next to `"t.setHeader ("GenieACS-Version", version)"` the following text `"t.setHeader ("Access-Control-Allow-Origin","*")"` and managed to solve my problem, but this is certainly not the correct solution, would anyone know to tell me what would be the correct solution so that I can safely use the GenieACS API? (I’m using version 1.2 of GenieACS)

PS: I tried to add it to the “/lib/nbi.ts” file too, but it didn’t work, do I have to recompile it? how do I recompile GenieACS?

---

<div class="post-metadata">

**Author:** ![wariator](https://avatars.discourse-cdn.com/v4/letter/w/ac8455/32.png) [@wariator](https://forum.genieacs.com/u/wariator)\
**Post date:** [August 2, 2021, 2:21pm UTC](https://forum.genieacs.com/t/cors-problems-in-genieacs-nbi-temporary-solution-found/603/2 "2021-08-02T14:21:52Z")

</div>

I have a similar problem. Do you solveted it?

---

<div class="post-metadata">

**Author:** ![JonasGhost](https://yyz1.discourse-cdn.com/flex035/user_avatar/forum.genieacs.com/jonasghost/32/286_2.png) [@JonasGhost](https://forum.genieacs.com/u/JonasGhost)\
**Post date:** [August 2, 2021, 3:05pm UTC](https://forum.genieacs.com/t/cors-problems-in-genieacs-nbi-temporary-solution-found/603/3 "2021-08-02T15:05:12Z")

</div>

Please do not try using client side JavaScript to interact with the nbi.  
Use server side programming with safety checks in place, otherwise it is a serious security risk. Only your server that is interacting with the nbi should have access to it.

---

<div class="post-metadata">

**Author:** ![wariator](https://avatars.discourse-cdn.com/v4/letter/w/ac8455/32.png) [@wariator](https://forum.genieacs.com/u/wariator)\
**Post date:** [August 3, 2021, 11:53am UTC](https://forum.genieacs.com/t/cors-problems-in-genieacs-nbi-temporary-solution-found/603/4 "2021-08-03T11:53:41Z")

</div>

and how i should upload files with api?

---

<div class="post-metadata">

**Author:** ![wariator](https://avatars.discourse-cdn.com/v4/letter/w/ac8455/32.png) [@wariator](https://forum.genieacs.com/u/wariator)\
**Post date:** [August 3, 2021, 12:33pm UTC](https://forum.genieacs.com/t/cors-problems-in-genieacs-nbi-temporary-solution-found/603/5 "2021-08-03T12:33:39Z")

</div>

solved.  
i just implement in nbi.js “else if” for method “OPTIONS” and allow header keys.
