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

168
Views
Why cookie is not set?

Do you have any idea why cookie is not set in client? It is sent from backend:

func loginEmail(_ req: Request) throws -> Response
{
    let response = Response(status: .ok)
    let cookie = HTTPCookies.Value(string: "abcdef")
    response.cookies["userId2"] = cookie
    return response
}

it is visible in browser in Network tab

set-cookie: userId2=abcdef; Path=/; SameSite=Lax

but not on Application enter image description here

GET is sent to backend. Backend runs on 8080 port, frontend on 3000.

I use axios in a React / Next.js app for calling endpoint:

const login = () => {
  axios
    .get(`http://localhost:8080/loginEmail`)
    .then((res) => {})
    .catch((err) => console.error(err));
};

I am using Vapor as backend, and has the following configurations, maybe they matter:

app.middleware.use(CORSMiddleware(configuration: .init(
    allowedOrigin: .originBased,
    allowedMethods: [.GET, .POST, .PUT, .OPTIONS, .DELETE, .PATCH],
    allowedHeaders: [.accept, .authorization, .contentType, .origin, .xRequestedWith, .userAgent, .accessControlAllowOrigin, .init("crossDomain"), .accessControlAllowCredentials, .xRequestedWith]
)))

app.sessions.configuration.cookieName = "userId2"

// Configures cookie value creation.
app.sessions.configuration.cookieFactory = { sessionID in
    print("sessionID.string: \(sessionID.string)")
    return .init(string: sessionID.string, isSecure: false)
}

app.middleware.use(app.sessions.middleware)
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!