After deploying both my backend written in Go (using railway) and frontend written using React (using Vercel) setting cookies no longer seems to work. This wasn’t a problem when working with both of them locally, only after I deployed them.
For context, here is what sets the cookie:
http.SetCookie(w, &http.Cookie{
Name: "auth_token",
Value: tokenString,
Expires: expirationTime,
Secure: true,
SameSite: http.SameSiteLaxMode,
HttpOnly: true,
Domain: domainName,
})
This is the request I am making on the frontend:
const res = await axios.post(api.login, formData, {
withCredentials: true,
});
I’m expecting the cookie to be set in the frontend like it was when I was testing and working locally, however after deploying both frontend and backend it seems to not work.