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

339
Vistas
Chrome extension proxy authentication

I've got problem in proxy authentication using chrome extension (due to problems with v3 my code is based on manifest v2). The connection works using the following curl command:

curl -v -x https://11.111.11.111:222 https://www.google.com/ --proxy-header "proxy-authorization: Basic abc" --proxy-insecure

And I tried to implement it in extension. Here's what I have in background.js file:

chrome.runtime.onStartup.addListener(() => {
    const config = {
            mode: 'fixed_servers',
            rules: {
                singleProxy: {
                    host: '11.111.11.111',
                    port: 222,
                    scheme: 'https',
                },
            },
        }

        chrome.proxy.settings.set({ value: config, scope: 'regular' })
})

chrome.webRequest.onBeforeSendHeaders.addListener(
    (details) => {
        const requestHeaders = details.requestHeaders || []
        requestHeaders.push({
            name: 'proxy-authorization',
            value: 'Basic abc',
        })

        return { requestHeaders }
    },
    { urls: ['<all_urls>'] },
    ['blocking', 'requestHeaders', 'extraHeaders']
)

chrome.webRequest.onSendHeaders.addListener(
    (details) => {
        console.log('sending', details)
        return details
    },
    { urls: ['<all_urls>'] },
    ['requestHeaders', 'extraHeaders']
)

I have the following permissions in manifest.json:

"permissions": [
        "cookies",
        "storage",
        "tabs",
        "activeTab",
        "proxy",
        "webRequest",
        "webRequestBlocking",
        "<all_urls>"
    ]

And these are the headers that are printed in onSendHeaders function:

enter image description here

You see that proxy-authorization header is present. But I get ERR_PROXY_CERTIFICATE_INVALID while trying to browse any page. Proxy headers should be set in a different way? Because I use --proxy-header flag in the curl command, not --header.

PS. I tried using the method that is mentioned many times:

chrome.webRequest.onAuthRequired.addListener(function(details, callbackFn) {
    callbackFn({
        authCredentials: { username: username, password: password }
    });
},{urls: ["<all_urls>"]},['asyncBlocking']);

too, but this function is never called (I put console.log inside).

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