Ask Your Question
3

front nova-novncproxy with nginx

asked 2014-02-27 17:46:42 -0600

jharley gravatar image

In order to deal with firewire rules and potentially restrictive environments, I want to proxy connections into noVNC on tcp/6080 with nginx. From what I can tell, I've setup nginx to properly proxy websockets but noVNC is returning 'Server disconnected (code: 1006)'. I can connect directly to the service just fine directly on 6080.

Has anyone got this to work in their environment?

My nginx config, for reference:

  location /console {
        rewrite ^/console/(.*) /$1 break;
        proxy_set_header x-forwarded-for $proxy_add_x_forwarded_for;
        proxy_set_header x-real-ip $remote_addr;
        proxy_set_header host $host;
        proxy_set_header x-forwarded-proto http;
        proxy_http_version 1.1;
        proxy_read_timeout 86400;

        proxy_pass http://127.0.0.1:6080;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "upgrade";
    }

With the intention of connecting to "http://mydashboardhost/console/vnc_auto.html?token=[...]" (nova's novncproxy_base_url property is set accordingly and 'nova get-vnc-console' returns a proper URL.

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
0

answered 2014-02-28 14:50:54 -0600

jharley gravatar image

I'll answer my own question, just in case anyone else stumbles upon this issue and wants to solve it.

With the help of Firebug, I saw that the noVNC application was telling my browser to do a 'GET /websockify', with that hint in mind I tweaked my nginx configuration and it now looks something like this:

upstream nova-consoleproxy {
    server 127.0.0.1:6080 fail_timeout=0;
}     

location /websockify {
          proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
          proxy_set_header X-Real-IP $remote_addr;
          proxy_set_header X-Forwarded-Host $host;
          proxy_set_header X-Forwarded-Server $host;
          proxy_set_header x-forwarded-proto https;
          proxy_set_header Host $host;
          proxy_http_version 1.1;
          proxy_read_timeout 86400;

          proxy_pass http://nova-consoleproxy;

          proxy_set_header Upgrade $http_upgrade;
          proxy_set_header Connection "upgrade";
        }

    location /console {
      rewrite ^/console/(.*) /$1 break;
      proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
      proxy_set_header X-Real-IP $remote_addr;
      proxy_set_header X-Forwarded-Host $host;
      proxy_set_header X-Forwarded-Server $host;
      proxy_set_header x-forwarded-proto https;
      proxy_set_header Host $host;
      proxy_http_version 1.1;
      proxy_read_timeout 86400;

      proxy_pass http://nova-consoleproxy;

      proxy_set_header Upgrade $http_upgrade;
      proxy_set_header Connection "upgrade";
    }
edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Get to know Ask OpenStack

Resources for moderators

Question Tools

1 follower

Stats

Asked: 2014-02-27 17:46:42 -0600

Seen: 1,854 times

Last updated: Feb 28 '14