https://www.ory.sh/ logo
#talk-kratos
Title
# talk-kratos
w

wooden-finland-38637

01/07/2022, 1:04 PM
Hello, We need to check cookies for every request in our express backend, for every request we need to send request for /session/whoami endpoint which adds delay. Is there any alternate way to check cookies
a

able-glass-7253

01/07/2022, 1:40 PM
Hello Akash, if your use case requires the ability to invalidate user sessions (e.g. logout), there is no way to authenticate a request without talking to an authentication server. What is the latency? If it is significant, you may be able to optimize it with adjustments to your deployment or system design
w

wooden-finland-38637

01/07/2022, 1:53 PM
We are testing in local server, concerned when deployed in production.
p

proud-plumber-24205

01/07/2022, 3:39 PM
This latency shouldn't be significant if kratos is in the same deployment (<1ms). There is no way around checking the session if the request requires an authenticated user. What kind of latency have you been experiencing?
w

wooden-finland-38637

01/07/2022, 3:41 PM
We are deploying Kratos in separate instance
p

proud-plumber-24205

01/07/2022, 3:50 PM
is the instance in the same datacenter ?
or in the same region?
w

wooden-finland-38637

01/07/2022, 3:53 PM
Same datacenter
p

proud-plumber-24205

01/07/2022, 3:53 PM
Then latency shouldn't be a problem 🙂
w

wooden-finland-38637

01/08/2022, 1:55 AM
Is this endpoint makes database call?
p

proud-plumber-24205

01/11/2022, 5:00 PM
I believe it does, but I could be wrong. I would need to look through this part of the code base to verify
h

high-optician-2097

01/14/2022, 3:25 PM
Thank you Alano, another way is to cache the cookie call for a bit. You might do that in your middleware or use something like Ory Oathkeeper :)
4 Views