热门标签 | HotTags
当前位置:  开发笔记 > 编程语言 > 正文

Firebase托管上的网站可以包含非https资源吗?-CansitesonFirebasehostingincludenon-httpsresources?

Ihavebeentryingtomigratemysitefromdivshottofirebase,sincefirebasehastakenoverdivsho

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

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

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。它还包含指向不支持https的外部站点的链接。该网站完美的divshot,但它看起来像firebase强制所有网站使用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.

混合内容:“https://mysite.firebaseapp.com/”上的页面是通过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.

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

Is there any way around this problem?

有没有解决这个问题的方法?

1 个解决方案

#1


4  

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.

最简洁的答案是不。这完全是设计上的。在https网站上允许http是一个安全漏洞。因此它被阻止了。

However,

然而,

  • Solution 1: Find a https version of resource This might not be possible in your case.
  • 解决方案1:查找资源的https版本在您的情况下可能无法实现。
  • 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.
  • 解决方案2:将资源转换为https可以使用https自行托管文件或资源。这可能要求你复制一个文件或其他东西,我谨慎地说,不要盗用你不应该的东西。
  • 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?)
  • 解决方案3:重定向这可能是最复杂的解决方案,但如果您尝试访问某些服务,那么您可以创建自己的服务来重定向它。你在firebase上,这意味着你可能会破解一些云功能来发出http请求(如何在Cloud Functions for Firebase中发出HTTP请求?)
  • 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.
  • 解决方案4:不要使用Firebase不想做上述任何一项,你不能忍受http呼叫?您可能只是转储firebase并转移到其他托管服务。

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

希望你发现这有用它可能不是你想要的答案,但它可能会指向你正确的方向。


推荐阅读
author-avatar
周茜闹心_325
这个家伙很懒,什么也没留下!
PHP1.CN | 中国最专业的PHP中文社区 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved | 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有