Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

256
Vistas
What HTTP code do you get if an SSL has expired?

I have a custom monitor code setup. I need to check if the specified URL has its SSL certificate expired. Is there a specific HTTP code for this? For example:

(async() => {
    const res = await fetch('http://example.com');
    // Or `statusText`
    if (res.status == some_ssl_expiryCode) {
        console.log('SSL expired!');
    }
})();

Is there a way to do this in javascript?

Thank you.

about 4 years ago · Juan Pablo Isaza
2 Respuestas
Responde la pregunta

0

The client application receives an HTTP 400 - Bad request response with the message "The SSL certificate error".

about 4 years ago · Juan Pablo Isaza Denunciar

0

As @Jasen said, the connection doesn't reach the server. The fetch request returns the error CERT_HAS_EXPIRED or CERT_INVALID. It does not produce an HTTP code. See the javascript code below.

import fetch from 'node-fetch';

fetch('https://example.com/')
    .then(async(res) => await res.text())
    .then(() => { // Do something if success })
            .catch(error => {
                console.error(error);
                if (error.code === 'CERT_HAS_EXPIRED') {
                    // Certificate has expired
                }
                if (error.code === 'CERT_INVALID') {
                    // Certificate is invalid
                }
            });

Hope this helps someone else who comes across this thread!

about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda