rabchev / web-terminal

Web-Terminal is a terminal server that provides remote CLI via standard web browser and HTTP protocol.
MIT License
443 stars 138 forks source link

Socket.io 404 #18

Closed howardroark closed 9 years ago

howardroark commented 9 years ago

Hey,

Is the expectation that socket.io files need to be gathered after setup? They seem to be missing from the web folder.

Thanks for any help on this!

rabchev commented 9 years ago

No, everything should be in place. How did you install?

howardroark commented 9 years ago

Whoops (should have realized this)... I tried it using an nginx reverse proxy from the get-go. It works without that method, but with it those files return 404. I guess whatever way node offers them combined with how nginx deals with proxy_pass causes those specific ones to never make it through.

Hrmmmm.... I don't suppose you have tried this behind an nginx reverse proxy? Hehe :P

rabchev commented 9 years ago

You have to add second location for socket.io. I agree this is sub-optimal and could be improved. Here is an example:

server {
        listen 443;
        server_name ec2-52-4-58-71.compute-1.amazonaws.com;

        ssl on;
        ssl_certificate /etc/nginx/ssl/nginx.crt;
        ssl_certificate_key /etc/nginx/ssl/nginx.key;
        ssl_ciphers HIGH:!ADH:!MD5;
        ssl_protocols SSLv3 TLSv1;
        ssl_prefer_server_ciphers on;

        proxy_buffers 32 128k;
        proxy_buffer_size 256k;

        location /terminal {
                proxy_pass http://localhost:8088/terminal;

                set $forwarded "for=$remote_addr;proto=https;host=$host;by=$server_addr";

                proxy_set_header Host $host;
                proxy_set_header X-Real-IP $remote_addr;
                proxy_set_header X-Forwarded-Host $http_host;
                proxy_set_header X-Forward-For $proxy_add_x_forwarded_for;
                proxy_set_header X-Forwarded-Proto https;
                proxy_set_header Forwarded $forwarded;

                proxy_http_version 1.1;
                proxy_set_header Upgrade $http_upgrade;
                proxy_set_header Connection "upgrade";
                proxy_read_timeout 43200000;
                proxy_set_header X-NginX-Proxy true;
        }

        location /socket.io {
                proxy_pass http://localhost:8088/socket.io;
        }

}
howardroark commented 9 years ago

Thanks for this! That last part is no big deal at all... As long as it is all the same to the browser :)