menu
Channels
Team

VScode Extension containing webview could not connect to REST service.

June 8, 2020 at 4:14pm

VScode Extension containing webview could not connect to REST service.

June 8, 2020 at 4:14pm (Edited 2 months ago)
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..?

June 9, 2020 at 7:02am
Do you have a VS Code extension to reproduce?
  • reply
  • like
Each new webview has to be launched in own unique origin for security reasons of running 3rd party content.
  • reply
  • like

June 9, 2020 at 2:27pm
Hi Anton, Thank you for your response. Is there a way to give custom name to the webview origin?
  • reply
  • like

June 10, 2020 at 8:21am
please look at https://github.com/eclipse-theia/theia/blob/master/CHANGELOG.md, search for THEIA_WEBVIEW_EXTERNAL_ENDPOINT
Edited
  • reply
  • like

July 10, 2020 at 8:33pm
Hi, Where should this be added.. In vscode Launch?
  • reply
  • like

July 13, 2020 at 1:07pm