Setting session cookie from your backend code, by returning the Set-Cookie header, doesn’t appear to be working for my autoscale deployment.
Repl link/Link to where the bug appears:
I have two urls, one deployed, one not. Both are the same repl, so running the same code. But only 1 works:
Deployed: https://multipad.codingcactus.codes/pad/cookie
Not deployed: https://multipad.codingcactus.repl.co/pad/cookie
The password is “password”
As you can see, with the deployed repl, entering the password just sends you back to the password page. This is because the cookie isn’t getting set:
I believe this is an issue with the way your Ruby app is configured.
Here’s an example of a Flask app that sets cookies. I’ve confirmed that this works in an Autoscale deployment: https://replit.com/@lincoln-replit/cookie-example
I would need to understand better how your application sets cookies to know how to better debug this situation. It’s possible there is an environment variable or something that we could set that would set the cookie on the correct URL.
Thank you for your example! It showed me the domain field of the Set-Cookie header is not required, so I removed it by adding this line:
set :cookie_options, domain: nil
All working perfectly now
1 Like
system
Closed
October 30, 2023, 8:27pm
4
This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.