drupal_goto forcing redirects to https when external link is http Our server uses https, but when we want to redirect to an external site that uses http, the https still gets added on. We will often have mixed links where some links are http and some are https. Our current call goes as:

drupal_goto($link, array("external" => TRUE));//where $link is the link we want to redirect to

Is setting the https option to false the way to go, or will it kill the links that should be https? I would think for an external link that drupal would not be trying to change that.

We changed the code to this, but it did not fix the issue:

$parsed = parse_url($link);
if ($parsed["scheme"] === "http") {
  $https = FALSE;
}
else {
  $https = TRUE;
}
// Forward to requested URL.
drupal_goto($link, ["external" =&gt; TRUE, "https" =&gt; $https]);
drupal_goto() takes a $path and $options which in turn sends them to url().
As you can see in the docs  for url()

https://api.drupal.org/api/drupal/includes%21common.inc/function/url/7


  'https': Whether this URL should point to a secure location. If not
  defined, the current scheme is used, so the user stays on HTTP or
  HTTPS respectively. TRUE enforces HTTPS and FALSE enforces HTTP, but
  HTTPS can only be enforced when the variable 'https' is set to TRUE.


so in your case the redirects will be https by default, which means you will have to set the them individually each time to use only http e.g.

drupal_goto($path, array("external" =&gt; TRUE, "https" =&gt; FALSE));