CORS problems in GenieACS-NBI (temporary solution found)

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?

I have a similar problem. Do you solveted it?

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.

1 Like

and how i should upload files with api?

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