Closed (fixed)
Project:
Simple XML sitemap
Version:
8.x-2.x-dev
Component:
Code
Priority:
Normal
Category:
Support request
Assigned:
Unassigned
Reporter:
Created:
9 Jan 2017 at 14:17 UTC
Updated:
20 Jul 2024 at 17:29 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
gbytePlease open up issues against the dev version next time.
As a quick fix I would suggest to use the 'base url' setting in the sitemap settings, there you can set the link base URL including https like so
https://your-domain.com.I do not have a SSL setup ATM to investigate properly, but the Drupal methods used in simple_sitemap should be generating https links themselves. - maybe your Drupal SSL setup is not correct?
Comment #3
gbyteClosing due to lack of response.
Comment #4
bwinett commentedWe are having the same issue. You can see it here: https://www.tek.com/sitemaps/1/sitemap.xml
Previously, we had left the default base url blank. But even after changing it to https://www.tek.com, as recommended in a previous comment, it remains the same.
Anyone know what "maybe your Drupal SSL setup is not correct" means?
Comment #5
gbyte\Drupal\Core\Url generates URLs according to the current scheme used. If you set your environment according to this, https links should show on the sitemap.
Comment #6
bwinett commentedI don't see anything on that page that would help us. Our D8 site is fully HTTPS, and it's working great. But our sitemap files point to HTTP.
Comment #7
Tentaculitis commentedin xmlsitemap (Drupal 7) you can change the Default base URL setting to https://

Example:
Comment #8
gbyte@Tentaculitis @bwinett You can do the above in simple_sitemap as well. Seems a bit like a workaround, but should work.
Comment #9
gbyteClosing this. If you find guys find a way to make it always recognize https without setting base URL, make sure to open up a feature request along with a patch (if possible).
Comment #10
gbyteComment #11
gbyteComment #12
gbyteComment #13
gbyteI have tested it and it should work without any workaround. Maybe your base URL setting was in fact the problem and removing it (or changing to https as described above) fixes the issue.
Comment #14
jascote commentedI was having a similar issue.
Our SSL is terminating upstream from Drupal (we're using a load balancer and varnish). When the sitemap is being generated, Drupal's paths are still http. The simple sitemap module conveniently provides an opportunity to alter your links prior to generating the sitemap chunks, so in a custom module I was able to force https using the code below.
Comment #15
gbyte@jascote Would using the module's
base_urlsetting not be an easier approach?Comment #16
jascote commented@gbyte.co That only worked for changing the sitemap index page. The elements on the individual sitemap pages were still being written as http. As far as I could tell in the SitemapGenerator.php, the base_url value isn't used in the individual sitemap chunks.
The
getCutsomBaseUrl()function is only used in thegenerateSitemapIndex()function.generateSitemapChunk()isn't looking for a custom base_url, it's just processing through the links.So adding a base url would fix the links on https://mydomain.com/sitemap.xml but on https://mydomain.com/sitemaps/2/sitemap.xml it was still http.
That's why I took the approach I used.
Comment #17
gbyte@jascote
There is UrlGeneratorBase::replaceBaseUrlWithCustom() which is used in several methods across UrlGeneratorBase responsible for returning links. So All links returned through the default generator set should adjust to the custom base URL. Maybe you experienced a caching issue? In 2.x chunks were still heavily cached.
I advise to use 3.x anyway; if you are not using custom code, there is a smooth upgrade path from 2.x.
Comment #18
a.milkovskyI can reproduce the issue.
My environment:
#7 base_url did not help me. I still see http links.
I am using a little bit extended version of #14 as a workaround for alternate_urls:
Comment #19
gbyte@a.milkowsky If your Drupal setup is correct the module produces https links. Adjusting the base URL in the settings to 'https://your-domain.com' should work regardless of your setup as it does a simple text replace. Please double check.
Comment #20
akalam commentedI can reproduce the issue as well. When regenerating the sitemap from UI it uses the base_url and works as expected, but when regenerated via cron it gets changed back to http
Comment #21
alina.basarabeanu commentedOur website has multiple domains and we left the default base URL empty as we do not want to generate the extra sitemap domains under the main one.
The links in the sitemap are generated with HTTP even if there is an SSL setup.
Please reopen the issue.
Comment #22
gbyteGuys this issue is for the unsupported 2.x version. If you experience this in 4.x, please update the issue accordingly and provide a step-by-step guide so I can reproduce - if possible on simplytest.me.
Comment #23
uri_frazierI know this is an old issue, but thank you @a.milkowsky for your solution. It works fine on version 4.1.9