VScode Extension containing webview could not connect to REST service

Hi I am facing a CORS error when trying to send a POST request from webview.

Access to XMLHttpRequest at ‘https://’ from origin ‘http://SOME-ID.webview.localhost:3000’ has been blocked by CORS policy: The ‘Access-Control-Allow-Origin’ header has a value ‘null’ that is not equal to the supplied origin.
Is there a way to give the web-view origin a name so we can add that as allowed origin name? I believe these ID’s keeps on changing…?

[original thread by nitika sharma]

Do you have a VS Code extension to reproduce?

Each new webview has to be launched in own unique origin for security reasons of running 3rd party content.

[nitika sharma]

Hi Anton, Thank you for your response. Is there a way to give custom name to the webview origin?

please look at https://github.com/eclipse-theia/theia/blob/master/CHANGELOG.md, search for THEIA_WEBVIEW_EXTERNAL_ENDPOINT

Hi @akosyakov where should i add this settings… Is it in the launch.json or webpack? looks like I have to use THEIA_WEBVIEW_EXTERNAL_ENDPOINT = {{hostname}} but not sure where. Can you help me with a sample if there’s any?

Hi I found it . Thanks

hello,where is the THEIA_WEBVIEW_EXTERNAL_ENDPOINT ?

In which file do you modify it(theia in docker)?