我们的环境要求我们的WindowsServer2019RDS网关(安装了HTML 5 web客户端)在nginx代理后面。网站部分工作正常,但当试图连接HTML 5 web客户端中的RDS终端会话应用程序时,连接会下降。使用RDS客户端运行得很好。
下面是我们的设置:
在客户端,我们得到web浏览器中的错误:
The connection to the remote PC was lost
在web检查器控制台中,我们看到一个关于无法建立web套接字连接的错误:
Gateway channel creation failed with error code=2147965402
和
Could not connect to wss://remote.domain.com/remotedesktopgateway/...
有没有人知道我们能做些什么来解决这个问题,这样我们就可以通过网络客户端访问我们的RDS应用程序了?
我似乎找不到任何文档来了解HTML 5 web客户端服务器到底需要什么。不幸的是,删除反向web代理不是一种选择。
发布于 2019-05-31 21:42:51
我最终解决了另一个问题:这个问题是由nginx反向代理添加的过度限制的内容安全策略头造成的。
以前,报头只有默认的-src;现在它有了image和media-src来允许数据:和blob:数据类型。这是当前正在工作的标题(可能过于宽松,但在我们能够进一步审查之前,它仍然有效):
default-src * data: 'unsafe-eval' 'unsafe-inline'; img-src * data: blob:; media-src * data: blob:
下面是相关的nginx配置(还有其他所有配置):
server {
listen 443 ssl http2;
listen [::]:443 ssl http2;
server_name remote.example.com;
# SSL
ssl_certificate /path/to/ssl/fullchain.pem;
ssl_certificate_key /path/to/ssl/privkey.pem;
ssl_trusted_certificate /path/to/ssl/chain.pem;
# reverse proxy
location / {
### IP address is permissible here
proxy_pass https://gateway.corp.domain.com:443/;
include conf.d/proxy.part;
}
# security headers
add_header X-Frame-Options "SAMEORIGIN" always;
add_header X-XSS-Protection "1; mode=block;" always;
add_header X-Content-Type-Options "nosniff" always;
add_header Referrer-Policy "no-referrer-when-downgrade" always;
### This is the header referenced above ###
add_header Content-Security-Policy "default-src * data: 'unsafe-eval' 'unsafe-inline'; img-src * data: blob:; media-src * data: blob:" always;
add_header X-Robots-Tag none;
add_header X-Download-Options noopen;
add_header X-Permitted-Cross-Domain-Policies none;
### Be careful with this header; this will cause your site to break if it ever stops serving over TLS
add_header Strict-Transport-Security "max-age=15552000; includeSubDomains";
# . files
location ~ /\. {
deny all;
}
# gzip
gzip on;
gzip_vary on;
gzip_proxied any;
gzip_comp_level 6;
gzip_types text/plain text/css text/xml application/json application/javascript application/xml+rss application/atom+xml image/svg+xml;
}我还在RDS服务器上添加了IIS重写规则,以便自动重写到web客户端的路径(例如,remote.example.com到remote.example.com/rdweb/webclient),不过这也可以在nginx中完成。
https://serverfault.com/questions/968276
复制相似问题