I am trying to set a cookie on an HTML page
func testCookie(c *gin.Context) {
c.SetCookie("test1", "testvalue", 10, "/", "", true, true)
c.HTML(200, "dashboard", gin.H{
"title": "Dashboard",
}
}
This should have set the cookie on the HTML page but it doesn't. My server is running to serve https requests. I am not sure why I am not able to set cookies here.
Adding to comments above Try using
c.SetCookie("cookieName", "name", 10, "/", "yourDomain", true, true)
example
c.SetCookie("gin_cookie", "someName", 60*60*24, "/", "google.com", true, true)