Welcome Guest, Not a member yet? Register   Sign In
Session destroyed after post from different ip
#1

(This post was last modified: 04-24-2021, 08:01 AM by z10892.)

Hello.
My session gets destroyed when I send form using post method from website that is hosted on different ip. If I send it from other website with same ip or change method to get then session is not destroyed. Result is the same no matter on url destination.
Is it some kind of additional security protection or do I have some bug? I was trying to find the reason of this behavior but failed to do so.
I'm using version 4.1.1 with csrf disabled
Reply
#2

Sessions will not work across domains. Best bet is to save the data in a shared database then pull it.
What did you Try? What did you Get? What did you Expect?

Joined CodeIgniter Community 2009.  ( Skype: insitfx )
Reply
#3

I'm not sure if we understood each other. I'm logged on domain a, then I go to domain b and send form to domain a, after that I get logged out on domain a.
Reply
#4

On localhost ?
If you change the sessionCookieName on config/App for one of your domain the problem persist ?
Reply
#5

I'm working on remote. Session cookie name is correct.
Reply
#6

You can read this it is a solution for a similar problem like yours.

How to Track your Users over Several Domains?
What did you Try? What did you Get? What did you Expect?

Joined CodeIgniter Community 2009.  ( Skype: insitfx )
Reply
#7

I'm not trying to share cookies across domains. I'm just trying to keep original session on domain "a" after posting some data from domain "b". Currently session gets destroyed after posting data. I can't find a reason why is this happening.
Reply
#8

(This post was last modified: 04-26-2021, 08:49 PM by InsiteFX.)

1) read the server log files.
2) set the env file to CI_ENVIRONMENT = development for debugging, rename to .env.
3) turn on CodeIgniters logger set the threshold  t0 9.
4) hit F12 in your web browser to see what is going on console and network tabs.

Also Sessions do use Cookies.
What did you Try? What did you Get? What did you Expect?

Joined CodeIgniter Community 2009.  ( Skype: insitfx )
Reply
#9

It was caused by cookieSameSite set to LAX. Thanks for trying to help.
Reply
#10

Glad you got it fix that's CORS doing it's thing again.
What did you Try? What did you Get? What did you Expect?

Joined CodeIgniter Community 2009.  ( Skype: insitfx )
Reply




Theme © iAndrew 2016 - Forum software by © MyBB