Render openvscode-server in an iframe

Hi,

I’m trying to embed vscode in my site.
Is it possible to render the UI that is served from the openvscode-server in an iframe?
I am able to run the docker image and access vscode on localhost:3000 but trying do to the same in an iframe gives me: “Forbidden.” as the response.

Is this a known constraint or am I doing something wrong?

Thanks!

We tried to integrate it in iframe in Gitpod, but it turned out that VS Code has assumption about running in top level document context to provide all features. I think you fork and mangle with code a bit you can get something running, but not everything.

Thanks @akosyakov! I’ll look into it.
Do you know why the server responds with forbidden?
How does it know it’s rendered in an iframe? and why does the mechanism that forbids it exist?

You should provide connection token as a part of iframe src.

Yes, I am passing the token as part of the src, and actually getting redirected properly.
Still, the redirection returns “Forbidden.”
image

@akosyakov I’m guessing it’s because of CORS.
I’ve put my iframe in a site that is served locally on port 4000 by webpack-dev-server.
Still dunno how to solve it.

nvm, it was something in my setup.
It is possible to render openvscode-server in an iframe.