unjs / redirect-ssl

Connect/Express middleware to enforce https using is-https
MIT License
100 stars 15 forks source link

Add exclude options which adds the ability to disable SSL redirect on some routes #5

Closed paulgv closed 6 years ago

paulgv commented 6 years ago

This adds an exclude option which accepts a list of patterns for which redirection should be disabled.

Usage

{
  exclude: [
    '^/health$',
    /^\/posts\/\d+/
  ]
}

Use case

I needed this because we're deploying Nuxt apps on Kubernetes clusters where the Ingress is secured but not the pod themselves, which caused the readiness and liveness probes to fail when trying to access the /health endpoint which was being redirected on its HTTPS equivalent.

Also, code has been linted using Standard rules.

manniL commented 6 years ago

Friendly ping @pi0

pi0 commented 6 years ago

Released with 1.4.0