我有一个由 nginx 代理的 nodejssails 应用程序。一切正常,但似乎无法连接到sails.io websocket。我在浏览器中收到以下错误
Refused to connect to 'wss://youtmail.tk/socket.io/?__sails_io_sdk_version=1.2.1&__sails_io_sdk_platform=browser&__sails_io_sdk_language=javascript&EIO=3&transport=websocket' because it violates the following Content Security Policy directive: "default-src https: data: 'unsafe-inline' 'unsafe-eval'". Note that 'connect-src' was not explicitly set, so 'default-src' is used as a fallback.
这是我的 nginx 配置文件
server {
server_name youtmail.tk;
location /{
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
proxy_pass http://localhost:1338;
listen 443 ssl; # managed by Certbot
ssl_certificate /etc/letsencrypt/live/youtmail.tk-0001/fullchain.pem; # managed by Certbot
ssl_certificate_key /etc/letsencrypt/live/youtmail.tk-0001/privkey.pem; # managed by Certbot
include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot
}
server {
if ($host = youtmail.tk) {
return 301 https://$host$request_uri;
} # managed by Certbot
}listen 80;
server_name youtmail.tk;
return 404; # managed by Certbot
}
有关如何解决此问题的任何帮助?