I have tested some cases and now I know that in the below code:
http {
lua_shared_dict test_shared 10m;
server {
listen 80 default_server;
server_name MyServer;
set $mylocalvar '';
}
}
we can set some keys on test_shared dictionary for sharing between all users and all tabs!
also on a connection when a user wants to open xyz.com page that we have tried to proxy that using openresty, mylocalvar inside server will be regenerated and rebuild for each asset and package on that page,
in other words, mylocalvar will be specific for each package (request), so if we have 2 images on that host, mylocalvar will be generated twice, once for image1 and once for image2!
but I have no Idea for making specific global shared variable for a connection ,(each tab contains one sharing object for all packages - requests)!
I think for last case, we can use context!am I right?
On Tuesday, June 12, 2018 at 4:56:24 PM UTC+4:30, Hadi Abbasi wrote:
hey there ..
I'm defining a nginx variable in nginx.conf
but I don't know if it will be shared for whole user connection or each request (like js and image) of my requested page?
and if I want to share a variable between all users, I don't know what I have to do?
thanks...
Best Regards,