pa11y / pa11y-ci

Pa11y CI is a CI-centric accessibility test runner, built using Pa11y
https://pa11y.org
GNU Lesser General Public License v3.0
509 stars 62 forks source link

The sitemap "https://mysite/sitemap.xml" could not be loaded #211

Closed KarelJanVanHaute closed 10 months ago

KarelJanVanHaute commented 10 months ago

I'm having the following problem. My site is running on docker through ddev. I have a custom local url, something like https://mysite. When I try to get that sitemap I get the error

The sitemap "https://mysite/sitemap.xml" could not be loaded

When I try it with "http://mysite/sitemap.xml" (so just HTTP) I get:

The sitemap "http://mysite/sitemap.xml" could not be parsed

I guess because in my sitemap all url's are pointing to HTTPS.

When I Curl the Https URL I get a working 200.

HTTP/2 200 
content-type: text/xml; charset=utf-8
date: Wed, 06 Sep 2023 17:22:42 GMT
server: Apache/2.4.56 (Debian)
x-content-type-options: nosniff
x-frame-options: SAMEORIGIN
x-powered-by: Craft CMS
x-xss-protection: 1; mode=block

When I try it with a similar sitemap from an online website over HTTPS it works just fine.

When I go to it with my browser I get the following code.

<sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
<sitemap>
<loc>https://mysite/sitemap_1_entry_4_contact.xml</loc>
<lastmod>2022-10-03</lastmod>
</sitemap>
<sitemap>
<loc>https://mysite/sitemap_1_entry_13_cookiepolicy.xml</loc>
<lastmod>2022-09-28</lastmod>
</sitemap>
<sitemap>
<loc>https://mysite/sitemap_1_entry_1_home.xml</loc>
<lastmod>2023-08-18</lastmod>
</sitemap>
<sitemap>
<loc>https://mysite/sitemap_1_entry_18_news.xml</loc>
<lastmod>2023-01-19</lastmod>
</sitemap>
<sitemap>
<loc>https://mysite/sitemap_1_entry_5_newsoverview.xml</loc>
<lastmod>2023-08-03</lastmod>
</sitemap>
<sitemap>
<loc>https://mysite/sitemap_1_entry_17_pages.xml</loc>
<lastmod>2023-08-18</lastmod>
</sitemap>
<sitemap>
<loc>https://mysite/sitemap_1_entry_19_privacypolicy.xml</loc>
<lastmod>2022-09-28</lastmod>
</sitemap>
</sitemapindex>

When I try to get all the pages from for example "https://mysite/sitemap_1_entry_18_news.xml" this also gives the could not load error. But when I try to get "http://mysite/sitemap_1_entry_18_news.xml" it works just fine. So it has something to do with the HTTPS.

KarelJanVanHaute commented 10 months ago

I've found a solution to my problem. I use mkcert for my certificates in ddev. This works great. But if you want to use them in a node module. Then you have to run the following command.

export NODE_EXTRA_CA_CERTS="$(mkcert -CAROOT)/rootCA.pem"