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

178
Vistas
HTML-Image-Tag Source request Authorization header in Vue.js 3

So, basically I'm trying to intercept the request from the HTML-Image-Tag, so that I can add my authorization header. I'm trying to do this with Vue.js 3. I've already tried to use a ServiceWorker to do so, but this didn't work as expected. The URLs called from the HTML-Image-Tag source will redirect to a cloud image. I can intercept the request, but cannot redirect to the destination url. I'm also still getting authorization errors.

Here is my code:

// imageInterceptor.js (in root folder)
self.addEventListener('fetch', (event) => {
  console.log(event)

  const newRequest = new Request(event.request, {
    headers: {
      Authorization:
        'Bearer __My-Token__',
    },
  })
  return fetch(newRequest)
})

// Registration in main.ts
await navigator.serviceWorker.register('/imageInterceptor.js')
about 4 years ago · Juan Pablo Isaza
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