Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Option to get around SSL cert issues when curling sitemap locally #251

Open
loopy3025 opened this issue Dec 27, 2024 · 1 comment
Open

Comments

@loopy3025
Copy link

loopy3025 commented Dec 27, 2024

Problem:

When we run pa11y in local development environments, fetching the sitemap fails, likely due to curl: (60) SSL certificate problem: self signed certificate. Unfortunately,

module.exports = {
  defaults: {
    chromeLaunchConfig: {
      ignoreHTTPSErrors: true,
    }
  }
};

only applies to the tested urls, not curling the sitemap itself.

Possible Solutions:

  • A flag that allows us to write a local test script where -k is added to the curl command to fetch the sitemap.
  • The ability to pull the sitemap from a file instead. This way, we could curl the sitemap to a folder then read it from there as a file.

Workarounds:

  • point to an upstream sitemap. This is our current solution, but it relies on the sitemap being up to date and running. It also precludes the ability to test new features locally with ease. We'd like to be able to add a new page with new features to the sitemap locally and test it before sending it upstream.
  • configure certs to every dev environment (NOPE)
@loopy3025 loopy3025 changed the title Option to add -k to sitemap fetch Option to get around SSL cert issues when curling sitemap locally Dec 27, 2024
@aarongoldenthal
Copy link
Contributor

@loopy3025 As you've seen, pa11y-ci uses fetch (node-fetch specifically) within the Node process to load the sitemap, but the chromeLaunchConfig is only passed to the browser. Until some fix is implemented, you might be able to use something like this to curl the sitemap, extract the urls, and convert them to a list, which pa11y-ci accepts:

$ pa11y-ci $(curl -sk https://somewhere.com/sitemap.xml | sed -n 's:.*<loc>\(.*\)</loc>.*:\1:p' | tr '\n' ' ')

This assumes your sitemap isn't nested, and is not using sitemap find/replace/exclude (although find/replace could be added with sed).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants