vSphere

 View Only
  • 1.  Embed html5 vm console in iframe

    Posted Aug 14, 2021 08:03 AM

    Hello,

    I am building a cyberrange with vSphere 6.7. I am using pyvmomi for the vSphere automation. When students start a cyberrange challenge, they get a link to a vm html5 console that opens a new browser window to the vm desktop. I want to embed the html5 console in an iframe instead of opening a new browser window. But, when the link is opened in an iframe, I get the vcenter login and after entering credentials, I get an error that the connection is refused. It works fine if the console is opened in a new browser window or tab.

    Any ideas?

     



  • 2.  RE: Embed html5 vm console in iframe

    Broadcom Employee
    Posted Aug 27, 2021 09:10 AM

    Hi,

    The vsphere client webapp (and the web console being part of that app) does not allow being embedded. If you examine the http response of the web console tab, or pretty much any request sent by the app, you will notice X-Frame-Options: deny response header. This basically instructs browser not to allow embedding.
    More info can be found here: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/X-Frame-Options 

    Instead you could try embedding the web console sdk in a custom web component of your own: https://code.vmware.com/web/sdk/2.1.0/html-console