Patch (to be ported)
Project:
XML sitemap
Version:
7.x-2.x-dev
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
18 Apr 2014 at 11:31 UTC
Updated:
26 Oct 2021 at 10:25 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
quicksketchLooks like this was added to the wrong queue? It doesn't sound like this has to do with Webform, so I'm moving to the XML Sitemap queue.
Comment #2
philsward commentedRan into the same issue. Doing some digging between a site with an older xmlsitemap version and a different site with the 2.0 version (both are https), I noticed the following differences between the two in the sitemap.xml source:
Older xmlsitemap
xmlsitemap 2.0
The 2.0 version inserts the https into the URL...
What I did as a workaround to make it work, was simply add the following into secure pages "include" list. (I only secure certain pages)
Once I added the sitemap.x* into the include list and refreshed the sitemap.xml page, it showed the human version of the sitemap.
Long story short, the way the URL is handled in 2.0 for the .xsl file, it is adding the entire host URI.
Comment #3
chris burge commentedI can confirm your observation. It is caused by #1276232: wrong stylesheet with multiple domain xmlsitemaps, which was included with 7.x-2.0.
Comment #4
chris burge commentedWhen the XSL file is included in the generated markup, the module uses the 'xmlsitemap_base_url' variable to generate the file's URL. The 'xmlsitemap_base_url' variable is required to specify a protocol in order to pass as a valid URL.
As a result, if a Drupal instance is configured with 'xmlsitemap_base_url' = 'http://example.com', then the XSL URL will be 'http://example.com/sitemap.xsl' in all instances, including when 'sitemap.xml' is loaded in HTTPS. In this case Firefox and Chrome will refuse to load the page.
I've attached a patch to address this issue. When generating the XSL file's URL, it removes the protocol and replaces it with '//' to designate a protocol-less URL.
Comment #5
chris burge commentedComment #6
chris burge commentedDrupal 6 version of patch. Switching to 6.x-2.x-dev for tests.
Comment #7
chris burge commented6.x-2.x branch tests are failing, so patch test is set to postponed. Setting issue back to 7.x-2.0
Comment #8
dave reidTweaked this a bit to help re-use some code elsewhere. Tested and confirmed it resolves issues using both HTTP and HTTPS.
Comment #9
dave reidCommitted to both 7.x-2.x and 6.x-2.x. Needs to be ported to 8.x-1.x.
Comment #12
dave reidPatch in #9 caused a regression with sitemap index generation, so added a follow-up commit to 7.x-2.x and 6.x-2.x. Patch provided if anyone needs it.
Comment #15
chris burge commented@Dave Reid - Thanks for moving this issue along!
Comment #16
philsward commentedJust updated to 2.1 and ran into the issue of:
Error loading stylesheet: A network error occurred loading an XSLT stylesheet:
Turns out my Default base URL setting was incorrect. Is there any way the error message can point to this as the fix? There will be a handful of people out there getting that error page with no idea how to fix it. Let me know if I need to create a new issue. (Wishing I had tested this patch before now...)
Haven't tested on https yet, so no feedback in that area.
Comment #17
ecvandenberg commentedAs stated in #16 I also notice the error loading stylesheet.
I also use Secure Pages (7.x-1.0-beta2). As a work around for this issue (https://www.drupal.org/node/2244449) I configured Secure Pages so that the page mydomein/sitemap.xml was shown unsecured (http).
With the update to XML sitemap 7.x-2.1 the unsecured sitemap gives an error loading stylesheet. Although Google Webmasters does not seem to have a problem with it, so no big deal.
I now configured Secure Pages to also secure the sitemap.xml page. Now the sitemap is shown, but without a stylesheet.
Comment #18
jmdorian commentedWhy not use the relative path to stylesheet.xsl? For example, replace
with
Comment #19
PascalAnimateur commentedHere's a patch implementing solution #18 which works in my case (was having problems with language prefix not being used on english sitemap.xsl)
Comment #20
interdruper commented#19 works for me.
Comment #21
gaurav.bajpai commented#19 works for me too, Thanks.
Comment #22
millerrs commentedCan confirm #19 works.
Comment #23
jenlamptonConfirm #19 works for me on 7.x as well, but the patch needed a reroll after 7.x.2.5 was released.
Comment #24
pifagorComment #26
pifagorComment #28
dave reidLooks like this also needs fixing in 8.x-1.x.
Comment #29
paul_leclerc commentedI'm not sure that this problem is caused by xmlsitemap.
If you are using a drush command to complete your cron or xmlsitemap:regenerate,
the mentioned piece of code will return a 'http' scheme to construct the xsl url.
To make the whole system to work with https protocol, you can simply add the uri param to the command.
drush xmlsitemap:regenerate --uri=https://xxxxxxxxxxThat's a reason why the xml rebuild works with the admin interface and not with the drush rebuild.
®DL