首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Win Server 2019 RDS HTML 5 web客户端不支持nginx web代理

Win Server 2019 RDS HTML 5 web客户端不支持nginx web代理
EN

Server Fault用户
提问于 2019-05-21 18:57:40
回答 1查看 5.6K关注 0票数 1

我们的环境要求我们的WindowsServer2019RDS网关(安装了HTML 5 web客户端)在nginx代理后面。网站部分工作正常,但当试图连接HTML 5 web客户端中的RDS终端会话应用程序时,连接会下降。使用RDS客户端运行得很好。

下面是我们的设置:

  • 服务器2019年RDS网关是gateway.corp.domain.com
  • 将RDS网关配置为使用remote.domain.com作为公共地址。
  • remote.domain.com指向nginx服务器。
  • nginx服务器(使用正确的web套接字头)向RDS网关(gateway.corp.domain.com)传递通信量。

在客户端,我们得到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代理不是一种选择。

EN

回答 1

Server Fault用户

回答已采纳

发布于 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配置(还有其他所有配置):

代码语言:javascript
复制
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.comremote.example.com/rdweb/webclient),不过这也可以在nginx中完成。

票数 1
EN
页面原文内容由Server Fault提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://serverfault.com/questions/968276

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档