Hi,

Got an issue regarding base urls on a multilingual drupal installation. Every language has it's own domain (.com/.fr/.nl etc.)
I have a feeling the HTTP/HTTPS state is read upon the CRON job, problem is that ONLY my .nl domain runs on HTTPS, all others domains are still regular HTTP.
Currently, the domains do work correctly, but it doesn't return the correct HTTP/HTTPS value.

I think the function that does this is getSiteMapUrl in xmlsitemap.xmlsitemap.inc, yet I have no idea how to properly fix this.
Regarding the functionality, I don't think you can tell anything about the website in the way the CRON is called, so my suggestion would be to add a force protocol option under "/admin/config/search/xmlsitemap/edit/[EDIT_ID]".

Happy to help and/or test regarding this issue, yet I can't develop this on my own.

Comments

vandijkstef created an issue.

Yury_Kaminski’s picture

URL is created from uri path and uri options that are generated by xmlsitemap_sitemap_uri function.

url($sitemap->uri['path'], $sitemap->uri['options']);

So, url() function is forcing http to https if we satisfy two conditions.

1) variable_get('https') == TRUE
2) xmlsitemap_sitemap_uri option $options['https'] = TRUE

So, it will be nice to add to xmlsitemap_sitemap_uri the following logic:

if (variable_get('https')) {
    $uri['options'] += array(
    'https' => TRUE,
  );

In this case we got https for all domains on site, if variable https is TRUE.

millerrs’s picture

I recently ran into this issue and was able to solve it by implementing hook_xmlsitemap_context_url_options in a custom module. Since the url() function has an option for HTTPS, simply set it to TRUE or FALSE depending on your use case.

In my case, I needed to disable HTTPS for China, so I did this:

function YOUR_MODULE_xmlsitemap_context_url_options(array $context) {
  $options = array();
  if (in_array('zh-hans', $context)) {
    $options['https'] = FALSE;
  }

  return $options;
}

If you want to enable HTTPS, remember that the https variable needs to be set to TRUE or else the url() function won't add it.