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

165
Vistas
Cross-origin request with 302 redirect doesn't set cookie on IOS for Chrome and FireFox

I have a hyperlink doing calling a node express API on heroku. The API sets a session cookie and redirects back the url of a single page application (frontend). The backend API is located on a different domain than the application frontend.

This works fine with

  • Chrome 92 Dektop
  • Firefox 91 Dektop
  • Safari on IOS
  • Opera on IOS

But the cookie is not set on

  • Chrome for IOS
  • Firefox on IOS

Chrome IOS and Firefox IOS will only do the redirect if I move the backend and Frontend on the same domain. This should nit be a requirement since the cookie is set with Secure, HttpOnly and SameSite=None. I suspect that the SameSite attribute is not set correctly or defaulted to Lax. I've tried some workarounds for old browsers but without success.

I use the code below to set the cookie on Node on my backend:

res.cookie('session', {
  // some data
}, {
  secure: true,
  httpOnly: true,
  sameSite: 'None',
  maxAge: 24 * 60 * 60 * 1000, // 24 hours
  signed: true
})
res.redirect(302, myRedirectUrl);

Express is configured as below:

// Enable CORS
app.use(cors({
  credentials: true, // Must be true for cookies to work.
  origin: true // Required if 'credentials' is true.
}));

// Initialize cookie parser used for session cookie.
app.use(cookieParser(process.env.COOKIE_PARSER_SECRET))

Once the backend has redirected, I fetch the API from teh frontend with HttpClient which is setup as below. No cokkies are passed with the requests.

this.http = new HttpClient();
this.http.configure(config => {
  config.withBaseUrl(this.apiUrl)
  .withDefaults({
    headers: {
      'Pragma': 'no-cache',
      'Cache-Control': 'no-cache'
    },
    credentials: 'include'
  })
  .rejectErrorResponses()
});
over 4 years ago · Santiago Trujillo
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