facebook tab default http over https

2019-08-14 03:53发布

问题:

I know this kind of question are asked all the time, I've mannaged to deal with all the https problems and all that.. but my problem now is when a user click on the app tab in my page, and their secure browsing option is disabled, they automatically redirected to the http url insted of the https. (my app can only work throu https).

I tried not putting anything in Page Tab URL: in the app settings as well as putting the https url there, but they both wont work...

how can I make my tab to default redirect to https url??

p.s. I've also tried redirecting by code like this:

if($_SERVER['HTTPS']!=”on”)
{
   $redirect= “https://”.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'];
   header(“Location:$redirect”);
}

and also like that:

if (!$_SERVER['HTTPS']) {
  header("HTTP/1.1 301 Moved Permanently");
  header('Location: https://[myappurl]');
  exit;
}

but it did not work

update: problem solved
I needed to fill up the app on facebook section on my application setting in facebook developer. I'm not sure why, but it worked.

回答1:

my app can only work throu https

You mean, will only “work” (in a sense of “only than can I guarantee the safety of user’s data”), or is only accessible via HTTPS?

how can I make my tab to default redirect to https url??

The user chose to browser facebook.com over HTTP, so Facebook will load the HTTP version of your app into the iframe. So unless you have at least one page of your app that is accessible via HTTP only – you can’t. If you do have such a page, redirect to the HTTPS version using JavaScript, top.location.href = "https://www.facebook.com/…"