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

185
Vistas
Set Cloudflare Cookie Based on GET Parameter

I am attempting to set the cloudflare cookie based on the GET Parameter. In this scenario, the GET Parameter is utm_source. Demo URL (worker is currently live): https://ellasbubbles.com/product/cultured-marble-trench-drain-shower-base-36x60-and-30x60/?utm_source=test

I was able to get a head start with this documentation, but cannot seem to get this to work properly. I am using inspect element on chrome to search for cookie and it is unfound - https://www.mikestreety.co.uk/blog/using-cloudflare-workers-to-set-a-cookie-based-on-a-get-parameter-or-path/

addEventListener('fetch', event => {
    event.respondWith(fetchAndApply(event.request))
})

async function fetchAndApply(request) {
    let response = await fetch(request);

    let url = new URL(request.url),
        refer = url.searchParams.get('utm_source');

    response = new Response(response.body, response);

    if(refer) {
        let partnerCookie = `source=${refer}; path=/; domain=https://ellasbubbles.com; secure; HttpOnly; SameSite=None`;
        response.headers.set('Set-Cookie', partnerCookie);
    }

    return response;
}
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