Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

281
Views
Las cookies se están configurando en el desarrollo, pero no en el servidor vercel

Mi aplicación consta de API (nestjs) y cliente (nextjs).

Estoy usando getServerSideProps para autenticar al usuario y redirigir al sitio de inicio de sesión si ocurre un error:

 export const getServerSideProps: GetServerSideProps = async (context) => { try { // Check whether the user is logged in await axios.get( `${process.env.NEXT_PUBLIC_API}/authentication`, { withCredentials: true, // Cookies are attached to the request with context headers: context.req ? { cookie: context.req.headers?.cookie || '' } : { cookie: '' }, }, ); return { props: {}, }; } catch (err) { return { redirect: { destination: '/login', permanent: false, }, }; } };

Código del lado del servidor para configurar cookies:

 public getCookieWithJwtToken(userId: number) { const payload: TokenPayload = { userId }; const token = this.jwtService.sign(payload); return `Authentication=${token}; HttpOnly; Path=/; Secure; SameSite=None; Max-Age=${this.configService.get( 'JWT_EXPIRATION_TIME', )}`; }

Las cookies funcionan bien en el modo de desarrollo. Puedo iniciar sesión, usar las utilidades para usuarios autenticados y cerrar sesión. Sin embargo, cuando implemento el servidor en vercel, las cookies no persisten en la pestaña Aplicación --> Cookies.

Las cookies se muestran en la respuesta de cookies, pero no se aplican en el navegador.

Información de cookies en producción:

ingrese la descripción de la imagen aquí

Las cookies funcionan según lo previsto en el desarrollo:

ingrese la descripción de la imagen aquí

He estado luchando con este problema durante varias horas hasta ahora, agradecería mucho la ayuda.

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!