Proxmox console with proxy

gody

New Member
Oct 28, 2015
3
1
1
Hi all,

I'm trying to implement a basic page to acces at the novnc console.
i'don't want give access at the webGui, so i try this:
http://img15.hostingpics.net/pics/874616proxmoxlab.png

Actually i'm able to:
- start/stop/restart/reset/shutdown
- show graph
- show current config and status


But for the novnc console, nothing work...

Prerequis:
- PVE user with VM.console = OK
- PHP class : https://github.com/CpuID/pve2-api-php-client

Apache vhost proxy configuration:
SSLProxyEngine on
ProxyRequests off
ProxyPreserveHost on
RequestHeader unset Accept-Encoding

ProxyPass /index.php !
ProxyPass / https://<proxmox_ip>:8006/
ProxyPassReverse / https://<proxmox_ip>:8006/


index.php (for test only) on apache2 vhost
PHP:
<?php
require('./pve2_api.class.php');
$pve2 = new PVE2_API('<proxmox_IP>', 'api_user', 'pve', 'api_user_pass');
$pve_node = 'pvesvr01';$pve_vmid = 505;
?>
<html>
<body>
<?php   
if ($pve2->login())    {        
$pve2->setCookie(); # this is the function I added to the php API client
$vncproxy = $pve2->post("/nodes/{$pve_node}/qemu/{$pve_vmid}/vncproxy", array("websocket" => 1)); 
$vncproxy['ticket'] = urlencode($vncproxy['ticket']);
$vncwebsocket = $pve2->get("/nodes/{$pve_node}/qemu/{$pve_vmid}/vncwebsocket?port={$vncproxy['port']}&vncticket={$vncproxy['ticket']}" , array('port' => $vncproxy['port'], 'vncticket' => $vncproxy['ticket'])); 

// CASE 1         
echo "<iframe  src='https://proxmox.lab/?console=kvm&novnc=1&vmid={$pve_vmid}&node={$pve_node}' frameborder='0' scrolling='no' width='1024px' height='100%'></iframe>";
// CASE 2         
echo "<iframe  src='https://proxmox.lab/' frameborder='0' scrolling='no' width='1024px' height='100%'></iframe>";    
}   
 else   
{       
 print('Login to Proxmox Host failed.\n');        
 exit;
}
?>
</body>
</html>


CASE 1 : http://img15.hostingpics.net/pics/361046proxmoxfailed.png
CASE 2 : http://img15.hostingpics.net/pics/910537case2.png
I'm on the GUI, i can, start /stop my assigned VM... but right click -> console, give me the same screen of CASE 1


pveproxy log:
<ip_proxy_apache> - api_cedric@pve [04/Nov/2015:14:12:25 -0500] "GET /api2/json/nodes/pvesvr01/qemu/505/vncwebsocket?port=5900&vncticket=PVEVNC%3A563A5898%3A%3AoKpCfObhcBf%2Bdn0Fmsk4eHD%2FHheJYlqgtX0bZgHpyDC1L7Tzb55IQSadZEG2JTgkhtlx23YTgIU0gsNhc70YHXJqFNqXi%2FBq2JuY7nq4uTodHGgvwSXhwLKhlJZmgElVmTki1s1LzJLLqJ9fn1%2BowydZdmo92oytnQ%2Bp1Th%2Bv%2FR3Zlm6FaAgOXOaC5Hl3zdzoS9mXDRnLFH5X1tEzb6RHsp%2B3XgyNWfnK5SbO4kGqOqyrAodkDFXmc9abUqrmK4Kyfe6BEerNwsTYGXXpNK9Y1J1GYx19QvYNa84CvtZdxXt7j7GcmfGkFetQL6f3JQ6ZciX9p%2FCtxli%2FmDmjcJmpQ%3D%3D HTTP/1.1" 200 24


proxmox.lab log (vncwebsocket call):
----------------------------------------------
FULL RESPONSE:
HTTP/1.1 200 OK
Cache-Control: max-age=0
Connection: Keep-Alive
Date: Wed, 04 Nov 2015 19:14:54 GMT
Pragma: no-cache
Server: pve-api-daemon/3.0
Content-Length: 24
Content-Type: application/json;charset=UTF-8
Expires: Wed, 04 Nov 2015 19:14:54 GMT
{"data":{"port":"5900"}}
END FULL RESPONSE
Headers:
HTTP/1.1 200 OK
Cache-Control: max-age=0
Connection: Keep-Alive
Date: Wed, 04 Nov 2015 19:14:54 GMT
Pragma: no-cache
Server: pve-api-daemon/3.0
Content-Length: 24
Content-Type: application/json;charset=UTF-8
Expires: Wed, 04 Nov 2015 19:14:54 GMT
End Headers
Data:
{"data":{"port":"5900"}}
End Data
RESPONSE ARRAY:
array (
'data' =>
array (
'port' => '5900',
),
)
END RESPONSE ARRAY
----------------------------------------------

Have you suggestion or idea ?
I don't understand why with the proxy i can't access the consol...

Thanks
 
Last edited:
  • Like
Reactions: aasami
Hi,

Same comportement on my PVE 4

If I type directly https://proxmox.lab (my apache 2.4 proxy)
I see the login page of proxmox.

I can log me in, start or stop vm but always not the console :(

I don't see what I Forgot.
 
Last edited: