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

897
Vistas
Error durante el registro del trabajador de servicio: DOMException: no se pudo registrar un trabajador de servicio para el alcance. Se produjo un error de certificado SSL

Estoy tratando de configurar mi apache para ejecutar la aplicación de reacción. Se ejecuta en localhost. Sin embargo, quiero redirigir http a https. Cuando hago eso, service-worker.js no funciona. Obtengo la excepción DOM. También he usado el certificado SSL

trabajador-servicio.js

 importScripts("https://storage.googleapis.com/workbox-cdn/releases/4.3.1/workbox-sw.js"); importScripts( "/precache-manifest.7167b3346c21d4ebe11be4972eadad7c.js" ); self.addEventListener('message', (event) => { if (event.data && event.data.type === 'SKIP_WAITING') { self.skipWaiting(); } }); workbox.core.clientsClaim(); self.__precacheManifest = [].concat(self.__precacheManifest || []); workbox.precaching.precacheAndRoute(self.__precacheManifest, {}); workbox.routing.registerNavigationRoute(workbox.precaching.getCacheKeyForURL("/index.html"), { blacklist: [/^\/_/,/\/[^\/?]+\.[^\/]+$/], });

Esta es mi configuración de Apache

El host donde se ejecuta mi aplicación

 <VirtualHost *:81> ProxyPreserveHost On ServerName 10.177.218.172 RemoteIPHeader X-Client-IP ErrorLog C:\APACHE\Apache24\logs\New_error.log CustomLog C:\APACHE\Apache24\logs\New_error.log combined LogLevel debug ShibCompatValidUser Off DocumentRoot "${SRVROOT}/Example" </VirtualHost>

Usar proxy inverso para obtener https

 <VirtualHost *:91> SSLEngine On SSLProxyEngine On SSLCertificateFile "root.crt" SSLCertificateKeyFile "server.key" SSLHonorCipherOrder on SSLProtocol all -SSLv2 -SSLv3 -TLSv1 -TLSv1.1 SSLCipherSuite HIGH:MEDIUM:!aNULL:!MD5:!SEED:!IDEA SSLProxyVerify none SSLProxyCheckPeerCN off SSLProxyCheckPeerName off RequestHeader set X-Forwarded-Proto "https" RequestHeader set X-Forwarded-Port "91" RequestHeader set REMOTE_ADDR "10.217.12.12" RequestHeader set HOST "10.217.12.12:91" <Location /> ProxyPass "http://10.217.12.12:81/" ProxyPassReverse "http://10.217.12.12/" </Location> </VirtualHost>

Recibo este error cuando ejecuto 10.217.12.12:91

 serviceWorker.js:97 Error during service worker registration: DOMException: Failed to register a ServiceWorker for scope ('https://10.217.12.12:91/') with script ('https://10.217.12.12:91/service- worker.js'): An SSL certificate error occurred when fetching the script.

¿Alguien tiene una idea para arreglar esto?

over 4 years ago · Santiago Trujillo
1 Respuestas
Responde la pregunta

0

El trabajador del servicio solo se ejecuta en modo seguro. React debe conocer la ubicación del archivo ssl. obtenga un certificado ssl para la aplicación de reacción, 1. Para linux, agregue esto a su archivo .env,

 SKIP_PREFLIGHT_CHECK=true SSL_CERT_FILE=./path/to/cert SSL_KEY_FILE=./path/to/keyfile.pem HTTPS=true

o, en su paquete.json

 "scripts": { "start": "set HTTPS=true && react-scripts start", "build": "react-scripts build", . ..
  1. Para ventanas,

    ($env:HTTPS = "true") -y (inicio npm)

lea esto para obtener más información, Reaccionar: Uso de HTTPS en desarrollo

over 4 years ago · Santiago Trujillo 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