Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cross domain configuration of websocket #261

Open
wh0am111 opened this issue Aug 19, 2020 · 5 comments
Open

Cross domain configuration of websocket #261

wh0am111 opened this issue Aug 19, 2020 · 5 comments

Comments

@wh0am111
Copy link

wh0am111 commented Aug 19, 2020

That's my configuration

upstream websocket {
     server 192.168.0.51:8008;
} 

server {
    listen       80;
    server_name  alpha3.www.exchange.com;

    root   /usr/share/nginx/html/dist/;
    index  index.html index.htm;

    error_page   500 502 503 504  /50x.html;
		location = /50x.html {
			root   html;
		}
    location /ws {
        add_header 'Access-Control-Allow-Origin' alpha3.www.exchange.com';
        proxy_pass http://websocket;
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "Upgrade";
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header Host $host;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    }

    location / {
             try_files $uri $uri/ @router;
             index index.html;
         }

    location @router {
            rewrite ^.*$ /index.html last;
        }

    location /api/ {
        add_header 'Access-Control-Allow-Origin' '*.niceex.com';
        proxy_pass http://alpha3.api.exchange.com/;
    }
    error_log   /tmp/vue-error.log;
    access_log  /tmp/vue-access.log mylog;
}

It's not work, It's also can be access from outside

Anyone know how to solve it?

@wh0am111
Copy link
Author

@haipome

@djpnewton
Copy link
Contributor

This does not look like a problem specific to viabtc exchange? It looks like you are having trouble with your nginx configuration

@wh0am111
Copy link
Author

This does not look like a problem specific to viabtc exchange? It looks like you are having trouble with your nginx configuration

yes

@wh0am111
Copy link
Author

This does not look like a problem specific to viabtc exchange? It looks like you are having trouble with your nginx configuration

But i think , maybe need viabtc backend config Cross domain ?

@djpnewton
Copy link
Contributor

the websocket server accessws does not care where the incoming connection comes from

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants