webssh icon indicating copy to clipboard operation
webssh copied to clipboard

Cross origin operation is not allowed.

Open shelbyKiraM opened this issue 4 years ago • 4 comments

When I try to click connect I get Cross origin operation is not allowed. in div.status? My server is set up not to allow cross origin scripts… I'm accessing the page through an NGINX proxy at https://ssh.example.com, as http://example.com:8888 doesn't load (prob due to something not working with my Cloudflare setup but also because I have HSTS set up so it has to be SSL).

Any thoughts? Maybe we need to rewrite the URL it's asking for the scripts from?

shelbyKiraM avatar Jun 16 '20 06:06 shelbyKiraM

Hello, I met the same problem with you. Have you solved the problem?

chenlhcodes avatar Nov 03 '20 03:11 chenlhcodes

Same error here. I think this is a nginx problem: The first time I used an almost empty config and that worked. Now I want to set it up on location /ssh/ of my server. Could that be related ?

rambip avatar Apr 19 '21 21:04 rambip

I found the config that worked for me with nginx:

server {
			listen 80;
location /ssh/ {
			proxy_pass http://localhost:8888/;

			proxy_set_header Host $http_host;

			proxy_read_timeout 300;
			proxy_set_header Upgrade $http_upgrade;
			proxy_set_header Connection "upgrade";
			proxy_set_header X-Real-IP $remote_addr;
			proxy_set_header X-Real-PORT $remote_port;
		}
}

For wssh to work with a reverse proxy, make sure the adress is /ssh/ and the proxy_pass is http://localhost:8888/` : all the slashes are important here.

Then, make sure you use add the header proxy_set_header Host $http_host to indicate the right host adress to wssh.

Maybe the X-forwarded-for header could work here, I didn't test it.

I hope this can be usefull to somebody !

rambip avatar Apr 20 '21 12:04 rambip