Statamic + Laravel Forge: POST/PATCH requests return 302 and cause redirect loop behind Cloudflare #13382
-
|
Hi everyone, I deployed a Laravel application with Statamic to a VPS using Laravel Forge. The application works correctly in local development, but after deployment I’m facing the following issues and wanted to ask if anyone else has experienced something similar. 1) Control Panel login only works when “Remember me” is checkedWhen logging into the Statamic Control Panel without selecting “Remember me”, the session does not persist and the login fails (I am redirected back as if not authenticated). 2) Editing, saving entries, or uploading files triggers
|
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
|
If you're getting a 302 then it sounds like the domain cloud flare is sending to the server is different from the one the server is expecting (I suspect http vs https?). That would explain most of your issues to be honest. |
Beta Was this translation helpful? Give feedback.
Hi Ryan,
Thanks so much for taking the time to respond! I checked everything on Cloudflare and the settings were okay.
I managed to resolve the issue and was actually related to session handling, although I'm not entirely sure whether this is the correct or recommended solution.
After some digging on Statamic's Discord, I found a similar case that pointed me to this GitHub issue:
#11411 (comment)
Following the suggestion there, I updated the
user_idcolumn in thesessionstable tovarchar(255). After doing that, everything started working correctly.That said, I'm still a bit unsure why this fixes the problem and whether it's safe to leave
sessions.user_idas a varchar long-term. At the m…