Embed proxmox console into an iframe

JVisi

New Member
Sep 23, 2022
15
0
1
Hello.
The following scenario is given:
I have a page on domain A, and this page is being served with nginx to domain B.
Proxmox is also available at domain B:8006

Embedding domain B:8006 /?console=lxc&vmid={vmid}&node={node}&resize=scale&xtermjs=1 to an iframe in domain A is the thing I'd like to achieve.

B:8006/?console.... works as expected in a browser tab, however, in an Iframe it's not sending the PVEAuthCookie and csrfPreventionToken, even though in the network tab they're there.

All in all, how could I open the console view in an Iframe, on a different domain?
1663947951591.png
 
Last edited:
Last edited:
you can give multiple values to the sandbox attribute, try both 'allow-same-origin' and 'allow-scripts'
 
can you post your html snippet ?
 
Code:
<iframe sandbox='allow-same-origin allow-scripts'
                        src={
                            "https://ip:8006/?console=lxc&novnc=1&vmid={vmid}&vmname={vmname}&node={node}"
                            } style={{ width: "100%", height: "100%" }} frameBorder={0}></iframe>

The url is good, opening it in another tab works fine, however from an Iframe, it gives 401 no ticket, even tho the parent page has a valid pveauth cookie, and CSRFPreventionToken
 
The url is good, opening it in another tab works fine, however from an Iframe, it gives 401 no ticket, even tho the parent page has a valid pveauth cookie, and CSRFPreventionToken
ok i think there is a misunderstanding, the iframe has to have the cookie not the parent page
 
ok i think there is a misunderstanding, the iframe has to have the cookie not the parent page
But I have no control over the iframe, and there's no way I could tell the Iframe to use these cookies.
Anyway I tried opening the whole page, and log in inside the iframe, but the same 401 no ticket error happened

Code:
<iframe sandbox='allow-scripts allow-same-origin' src='https://ip:8006' style={{width:"100%", height:"800px"}}></iframe>

this gave me the proxmox login window, I logged in, the cookie got set for the proxmox's domain (I checked in the dev-tools/application window) but still the error persists
 
mhmm ok after a bit of testing, it seems that using an iframe in this manner doesn't allow the embedded site to access cookies from it's origin, even when using 'allow-same-origin'
not sure how to circumvent that... (besides maybe using a reverse proxy in between that inserts a 'Access-Control-Allow-Origin' header)
 
mhmm ok after a bit of testing, it seems that using an iframe in this manner doesn't allow the embedded site to access cookies from it's origin, even when using 'allow-same-origin'
not sure how to circumvent that... (besides maybe using a reverse proxy in between that inserts a 'Access-Control-Allow-Origin' header)
I see, that's too bad. Thank you for your time and effort
 

About

The Proxmox community has been around for many years and offers help and support for Proxmox VE, Proxmox Backup Server, and Proxmox Mail Gateway.
We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get yours easily in our online shop.

Buy now!