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

241
Vistas
Send AJAX calls from main domain to subdomain

I know this may have been answered already but none of the solutions I found are working for me.

I have an AJAX call from example.com to api.example.com/v1, when sending the request, no cookie is sent.

EDIT:

My AJAX code is

$.ajax({
    type:"POST",
    url:"https://api.example.com/v1/",
    data: payload,
    processData: false,
    xhrFields: { withCredentials:true },
    crossDomain: true,
    xhrFields: { responseType: 'arraybuffer' },
    dataType: 'binary',
    contentType: 'application/octet-stream',
    headers: { "Csrf-Token": csrfValue, "accept": "application/octet-stream"},
    success: function(res) {
        // Some code here
    }
});

EDIT 2:

The headers set by the server on the preflight request are:

access-control-allow-credentials: true
access-control-allow-headers: Content-Type, Csrf-Token, Cookie
access-control-allow-methods: OPTIONS, POST
access-control-allow-origin: https://example.com
allow: OPTIONS, POST

EDIT 3:

My cookie values are:

Name: __Secure-Csrf-Token
Content: 4XAlnRWR95FKGcpYxZb6P9xxtFx1hP7XXU8rSShpnEY
Domain: .example.com
Path: /
Send for: Secure same-site connections only
Created: Wednesday, May 25, 2022 at 11:18:17 PM
Expires: When the browsing session ends

And yes, mi site uses HTTPS.

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

0

Okay so it looks like I was repeating the xhrFields param, so the first mention where I set the withCredentials: true was being overwritten.

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