Can sites on Firebase hosting include non-https resources?

大城市里の小女人 提交于 2020-01-13 08:04:22

问题


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

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:

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.

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?


回答1:


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.

However,

  • 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.



来源:https://stackoverflow.com/questions/34523385/can-sites-on-firebase-hosting-include-non-https-resources

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!