Firebase 托管上的网站可以包含非 https 资源吗? [英] Can sites on Firebase hosting include non-https resources?

查看:20
本文介绍了Firebase 托管上的网站可以包含非 https 资源吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在尝试将我的网站从 divshot 迁移到 firebase,因为 firebase 已经接管了 divshot 并将其关闭.

I have been trying to migrate my site from divshot to firebase, since firebase has taken over divshot and shut it down.

Mine 是一个简单的只读站点,不需要 https.它还包含指向不支持 https 的外部站点的链接.该网站在 divshot 上运行良好,但看起来 firebase 强制所有网站使用 https.不幸的是,这会导致我的站点引用的外部站点加载失败.错误是:

Mine is a simple read only site that does not need https. It also contains links to external sites which do not support https. The site worked perfectly on divshot but it looks like firebase forces all sites to use https. Unfortunately, this causes the external sites that my site references to fail loading. The error being:

混合内容:https://mysite.firebaseapp.com/" 页面已加载HTTPS,但请求了不安全的资源http://www.externalsite.com/".此请求已被阻止;内容必须通过 HTTPS 提供.

Mixed Content: The page at 'https://mysite.firebaseapp.com/' was loaded over HTTPS, but requested an insecure resource 'http://www.externalsite.com/'. This request has been blocked; the content must be served over HTTPS.

我试图删除 http: 所以外部站点只是//www.externalsite.com/,但这会导致证书错误.我无法将其更改为 https,因为此外部站点不支持它.

I tried to remove the http: so the external site is just //www.externalsite.com/, but this causes certificate errors. I can't change it to https since this external site doesn't support it.

有什么办法可以解决这个问题吗?

Is there any way around this problem?

推荐答案

简短的回答是否定的.这完全是设计使然.在 https 站点上允许 http 是一个安全漏洞.因此它被阻止了.

The short answer is no. This is completely by design. It's a security flaw to allow http on a https site. Therefore it's blocked.

然而,

  • 解决方案 1:查找 https 版本的资源这在您的情况下可能是不可能的.
  • 解决方案 2:将资源转换为 https 或许可以使用 https 自己托管文件或资源.这可能需要你复制一个文件或其他东西,我小心地说,不要盗版你不应该的东西.
  • 解决方案 3:重定向 这可能是最复杂的解决方案,但如果您尝试访问某些服务,那么您可以创建自己的服务来重定向它.您在 firebase 上,这意味着您可能可以将一些云功能组合在一起来发出 http 请求(如何在 Cloud Functions for Firebase 中发出 HTTP 请求?)
  • 解决方案 4:不使用 Firebase 不想执行上述任何操作并且您无法忍受 http 调用?您可能只是转储 firebase 并转移到其他托管服务.
  • Solution 1: Find a https version of resource This might not be possible in your case.
  • Solution 2: convert resource to https It might be possible to host the file or resource yourself with https. This may require you to copy a file or something, which I say carefully, don't pirate stuff that you shouldn't.
  • Solution 3: Redirect This one is probably the most involved solution to do but if you are trying to access some service then you could make your own service to redirect it. You are on firebase which means you could probably hack together some cloud function to make a http request (How to make an HTTP request in Cloud Functions for Firebase?)
  • Solution 4: Don't use Firebase Don't want to do any of the above and you can't live with out the http call? You might just dump firebase and move to some other hosting service.

希望这对您有帮助,它可能不是您要找的答案,但可能会为您指明正确的方向.

Hope you find this helpful it might not be the answer your looking for but it might point you in the right direction.

这篇关于Firebase 托管上的网站可以包含非 https 资源吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆