Mobile app version of vmapp.org
Login or Join
Angela700

: Detect Joomla session from nginx Currently I'm using nginx's fastcgi_cache to cache a Joomla front-end. The problem is the joomla session is encrypted, thus provide me no way to know when a

@Angela700

Posted in: #Joomla

Currently I'm using nginx's fastcgi_cache to cache a Joomla front-end. The problem is the joomla session is encrypted, thus provide me no way to know when a user is logged in in the front-end or not (from the nginx side).

Is someone here has a similar setup and how do you solve this problem?

10.01% popularity Vote Up Vote Down


Login to follow query

More posts by @Angela700

1 Comments

Sorted by latest first Latest Oldest Best

 

@Nickens628

Nginx is what is known as the webserver a.k.a. the middleman in the operations. It fetches the output of an executed PHP script (which is part of your Joomla CMS) to the network (internet) and then the output is passed to the user's browser then the browser decodes it to a format a user can understand.

at least 99% of websites with user account functionality involve a section where one logs into the server and once successful, a cookie is stored on the users browser to signify that the user is logged in. If the server is smart, then the cookie should be encrypted.

In PHP, generally one would use sessions which are cookies but PHP automatically encodes them for you.

Since I don't have Joomla, I won't know exactly what cookie to look for, but you can make a script that displays cookies before and after login so you know exactly what to look for. The script will be like this:

<?php
error_reporting(7);
session_start();
header("content-type:text/plain",true);
echo "Sessions:nn";
$sess=$_SESSION;
if (is_array($sess)){
foreach ($sess as $n=>$v){
echo $n." = ".$v."n";
}
}
echo "Cookies:nn";
$cook=$_COOKIE;
if (is_array($cook)){
foreach ($cook as $n=>$v){
echo $n." = ".$v."n";
}
}
?>


Then go in a browser and make sure all existing cookies are cleared. Then when you first run the script, there should be nothing listed under cookies. Next, open a new window in the same browser (no private windows), and login to your website. The moment your login is successful, switch to the first window that showed the cookie status and reload the screen. This time, you should see at least something listed under Cookies. Try different successful logins and depending on how many cookies are set per login, one might change.

This will be the best answer you'll get since login systems can be different from server to server and many servers store cookies on user's computers when they are logged in.

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme