简体   繁体   中英

How can I communicate with the API server from the firebase hosting URL?

I use Vue for Front, Laravel for Back, and aws for server. But we are using firebase hosting to use FCM. In local, requests are sent well from front to back, but not from host URL.

Because we are making a request to the server as http. So I tried to apply ForceSSL to the server, but it didn't work.

If you've had the same difficulty as me, I'd like you to tell me how to solve it.

My error is

Mixed Content: The page at ' https://firebase hosting Url/login' was loaded over HTTPS, but requested an insecure XMLHttpRequest endpoint ' http://my ip/api/login'. This request has been blocked; the content must be served over HTTPS.

it looks like your website is running under http protocol if you have SSL certificate then make sure to install it correctly on your domain

if you already have it then all you need to do is to add these lines to your .htaccess file (if your on apache server)

RewriteEngine On
RewriteCond %{HTTPS} !=on
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301,NE] 

useful links: https://help.dreamhost.com/hc/en-us/articles/215747758-Force-your-site-to-load-securely-with-an.htaccess-file

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM