# \[SOLVED\] Unable to VNC when going through Apache proxy

**URL:** <https://forum.opennebula.io/t/solved-unable-to-vnc-when-going-through-apache-proxy/5263>\
**Category:** Product Support\
**Created:** [November 13, 2017, 3:30pm UTC](https://forum.opennebula.io/t/solved-unable-to-vnc-when-going-through-apache-proxy/5263 "2017-11-13T15:30:22Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![mh\_opennebula](https://avatars.discourse-cdn.com/v4/letter/m/aca169/32.png) [@mh\_opennebula](https://forum.opennebula.io/u/mh_opennebula)\
**Post date:** [November 13, 2017, 3:30pm UTC](https://forum.opennebula.io/t/solved-unable-to-vnc-when-going-through-apache-proxy/5263/1 "2017-11-13T15:30:22Z")

</div>

Hello everyone, seems to be lots of info on this topic, but we are unable to use VNC when going through an Apache proxy. VNC works as expected if accessed directly from OpenNebula/Sunstone, and we are able to access and perform all other functions through the proxy, but when accessing VNC through proxy we get the " VNC Server disconnected (code: 1006)" so I assume it is related to websockets/ws\_tunnel? Here are the details:

Ubuntu 16.04.3  
OpenNebula 5.4 on single host (IP 192.168.1.71)  
Apache 2.4.18 with wstunnel enabled (IP 192.168.1.90)  
No firewalls between OpenNebula host and Apache host  
ss -ntap |grep 29876  
LISTEN 0 100 \*:29876 _:_  
SSL not used  
sunstone-server.conf  
:vnc\_proxy\_support\_wss: no

Pretty sure this is where the issue is… just do not know how to resolve  
apache config:  
ProxyRequests off  
RewriteEngine on  
ProxyPreserveHost on  
ProxyPass / [http://192.168.1.71:9869/](http://192.168.1.71:9869/)  
ProxyPass / ws://192.168.1.71:9869/

apache log entry:  
“POST /vm/11/startvnc HTTP/1.1” 200 568 “[http://192.168.1.90/](http://192.168.1.90/)” “Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:56.0) Gecko/20100101 Firefox/56.0”

firefox console:  
Firefox can’t establish a connection to the server at ws://192.168.1.90:29876/?token=blahblahblah - shouldn’t firefox try to connect to .71?

I am open to using nginx, and have tried briefly with basically the same result. I’m sure it is a ‘ws’ directive issue, just not sure what.

Thanks in advance.

---

<div class="post-metadata">

**Author:** ![mh\_opennebula](https://avatars.discourse-cdn.com/v4/letter/m/aca169/32.png) [@mh\_opennebula](https://forum.opennebula.io/u/mh_opennebula)\
**Post date:** [November 14, 2017, 5:53pm UTC](https://forum.opennebula.io/t/solved-unable-to-vnc-when-going-through-apache-proxy/5263/2 "2017-11-14T17:53:52Z")

</div>

Really could use some help, thoughts, suggestions, etc. I believe I have almost found the end of the internet looking for the solution…

Thanks in advance.

---

<div class="post-metadata">

**Author:** ![mh\_opennebula](https://avatars.discourse-cdn.com/v4/letter/m/aca169/32.png) [@mh\_opennebula](https://forum.opennebula.io/u/mh_opennebula)\
**Post date:** [November 15, 2017, 3:19pm UTC](https://forum.opennebula.io/t/solved-unable-to-vnc-when-going-through-apache-proxy/5263/3 "2017-11-15T15:19:06Z")

</div>

So i believe the issue appears to be related to this:

Firefox can’t establish a connection to the server at ws://192.168.1. **_90_** :29876/?token=blahblahblah

The .90 is the proxy, not the sunstone server. Any ideas/thoughts on why it is trying to access the proxy rather than sunstone?

---

<div class="post-metadata">

**Author:** ![mh\_opennebula](https://avatars.discourse-cdn.com/v4/letter/m/aca169/32.png) [@mh\_opennebula](https://forum.opennebula.io/u/mh_opennebula)\
**Post date:** [November 15, 2017, 3:55pm UTC](https://forum.opennebula.io/t/solved-unable-to-vnc-when-going-through-apache-proxy/5263/4 "2017-11-15T15:55:49Z")

</div>

I was able to resolve this using traefik as the proxy and configuring an additional entrypoing, frontend, and backend for port 29876. this proxied the traffic from the client machine to sunstone when it tried to access port 29876 on the proxy.

---

<div class="post-metadata">

**Author:** ![Igor](https://avatars.discourse-cdn.com/v4/letter/i/dec6dc/32.png) [@Igor](https://forum.opennebula.io/u/Igor)\
**Post date:** [May 18, 2018, 2:15pm UTC](https://forum.opennebula.io/t/solved-unable-to-vnc-when-going-through-apache-proxy/5263/5 "2018-05-18T14:15:42Z")

</div>

Can you post your apache configuration here please??

I have an apache using mod\_proxy, i reverse in https the opennebula FE but when i try to open vm consoles under novnc or spice, nothing appear.

ATM the apache server configuration reverse proxying OpennebulaFE is:

\<VirtualHost \*:443\>  
ServerName localhost

ProxyPreserveHost Off

RewriteEngine on  
RewriteRule ^(.\*)+(nebula)$ %{REQUEST\_URI}/ [R=301,L]

SSLEngine on  
SSLCertificateFile /etc/pki/certs/xxxx.crt  
SSLCertificateKeyFile /etc/pki/private/xxxxx.key  
SSLCertificateChainFile /etc/pki/certs/xxxxxxxx.pem

\<Location /nebula\>  
ProxyPass [http://xx.xx.xx.xx:9869](http://xx.xx.xx.xx:9869)  
ProxyPassReverse [http://xx.xx.xx.xx:9869](http://xx.xx.xx.xx:9869)

Many thanks

Igor

---

<div class="post-metadata">

**Author:** ![jaimeibar](https://avatars.discourse-cdn.com/v4/letter/j/96bed5/32.png) [@jaimeibar](https://forum.opennebula.io/u/jaimeibar)\
**Post date:** [April 4, 2023, 8:52am UTC](https://forum.opennebula.io/t/solved-unable-to-vnc-when-going-through-apache-proxy/5263/6 "2023-04-04T08:52:19Z")

</div>

Hi @mh_opennebula ,

I’m having the same issue setting up traefik v2 and sunstone/vnc.

Can you please share your traefik configuration?  
I’ve tried different solutions but nothing worked.

Thanks  
Jaime
