【问题标题】:SSL on cloud storage with custom domain具有自定义域的云存储上的 SSL
【发布时间】:2017-07-02 04:13:38
【问题描述】:

我将我的 SSL 证书上传到 GAE。该表单未显示证书中的子域“images.floridata.com”之一。映射到 ghs.googlehosted.com 的其他子域显示为复选框,单击这些复选框可以激活该子域的 SSL。但映射到 c.storage.googleapis.com 的 images.floridata.com 不是。

我们使用 Google 的 Cloud DNS。有人能告诉我如何为这个子域启用 SSL 吗?

如果我不在此子域上启用 SSL,用户会收到“混合内容”错误吗?

我的网站是一个 Golang 应用程序,因此在我的 app.yaml 文件中我有一个“安全:始终”条目 - 这会阻止通过 http 传递图像导致“混合内容”错误。

谢谢!

【问题讨论】:

    标签: google-app-engine ssl subdomain google-cloud-storage app.yaml


    【解决方案1】:

    “c.storage.googleapis.com”DNS 重定向功能不适用于 HTTPS 地址。它只支持 HTTP。

    为了通过 HTTPS 处理自定义域,您需要使用它设置 Google Cloud Load Balancingregister your SSL certificate,然后设置 configure it to be backed by a GCS bucket

    【讨论】:

      【解决方案2】:

      我在 Nginx、Apache 或类似设备上使用 Proxy 解决了这个问题 就我而言,在测试 Firebase 和负载平衡 2 周后,我发现了该解决方案,并且使用我自己的域的 HTTPS 可以正常工作。

      https://github.com/presslabs/gs-proxy/blob/master/nginx.conf

      或者您可以使用此解决方案代理子文件夹

      upstream gs {
          server storage.googleapis.com:443;
          keepalive 128;
      }
      
      server {
      
          ## YOUR CURRENT CONFIG ##
      
          location ~ /cdn/(.*)$ {
      
              proxy_set_header    Host storage.googleapis.com;
              proxy_pass          https://gs/BUCKETNAME/subpath/$1;
              proxy_http_version  1.1;
              proxy_set_header    Connection "";
      
              proxy_intercept_errors on;
              proxy_hide_header       alt-svc;
              proxy_hide_header       X-GUploader-UploadID;
              proxy_hide_header       alternate-protocol;
              proxy_hide_header       x-goog-hash;
              proxy_hide_header       x-goog-generation;
              proxy_hide_header       x-goog-metageneration;
              proxy_hide_header       x-goog-stored-content-encoding;
              proxy_hide_header       x-goog-stored-content-length;
              proxy_hide_header       x-goog-storage-class;
              proxy_hide_header       x-xss-protection;
              proxy_hide_header       accept-ranges;
              proxy_hide_header       Set-Cookie;
              proxy_ignore_headers    Set-Cookie;
          }
      
          # location / { ... #
      }
      

      根据您的需要,您必须在云存储中激活 Access-Control-Allow-Origin。

      代理很便宜,然后负载平衡,如果您需要 SEO 是一个不错的选择。

      【讨论】:

      • 你用什么 nginx 实例来做这个(成本)?
      • Onlu 在便宜的实例上安装 nginx。
      • 您能分享一下您为负载平衡所做的工作吗?
      • 我没有做任何负载均衡,因为在我的 laravel / php / nginx 实例(Google VM 实例)中非常昂贵。我将 Nginx 配置为代理,而不是负载平衡,以节省资金。上面的代码是 Nginx 配置。
      猜你喜欢
      • 2018-04-04
      • 2014-11-06
      • 2022-01-04
      • 1970-01-01
      • 2013-08-19
      • 2020-01-17
      • 1970-01-01
      • 2023-02-25
      • 2016-03-29
      相关资源
      最近更新 更多