Hello,In my extension i need to access an external rest service but this web service address may change for an opened workspace/folder. What will be the best way? Should i access it from frontend? Will cors be problem? Or should i a create proxy service in backend but i dont know whether it is possible to access preferences from backend(i thought i can hold that ws address in user preferences) since they seem to be frontend specific. Thanks in advance
[original thread by anil chalil]
You can do in either way. Whether something cause cors or security issues is a matter of server configurations and how much you trust user browser.
I’d prefer using a single backend which I access from within my browser applications. The backend itself is responsible for delegating requests to appropriate servers. This will not only avoid CORS problems and decouples client code from multiple backend configurations. Just implement a simple BackendApplicationContribution to delegate all request under a certain url path to another server. Here is an example https://github.com/javahacks/urdf-designer/blob/master/theia-ide/urdf-extension/src/node/backend-extension.ts