openresty/1.13.6.2, problem with lua isolation per nginx server BLOCK

51 views
Skip to first unread message

Nguyễn Trần Tấn Tuấn

unread,
Nov 24, 2018, 9:39:31 PM11/24/18
to openresty-en
HI every body
I have this issue with openresry 1.13.6.2. Let me show the problem 
I have sample config below
server {
       
        server_name muacard.vn www.muacard.vn;
        charset utf-8;
        set $native_ssl 0;
        .....
location / {
               ...
   rewrite_by_lua_block {
                                cookie_erandom  = ngx.var.cookie_erandom
                                cookie_etoken   = ngx.var.cookie_etoken
                                remote_addr     = ngx.var.remote_addr
                                request_uri     = ngx.var.request_uri                             
                                domain          ="muacard.vn"
                                if (cookie_erandom == nil) then
                                        return ngx.redirect("/auth?m=er&dm=muacard.vn&url=" .. request_uri)
                                end
                                local etoken = ngx.md5(muacard .. remote_addr .. cookie_erandom)
                                if (cookie_etoken ~= etoken) then
                                        return ngx.redirect("/auth?m=et&dm=muacard.vn&url=" .. request_uri)
                                end
                        }
....
}
server {
       
        server_name testiq.vn www.testiq.vn;
        charset utf-8;
        .....
location / {
               ...
   rewrite_by_lua_block {
                                cookie_erandom  = ngx.var.cookie_erandom
                                cookie_etoken   = ngx.var.cookie_etoken
                                remote_addr     = ngx.var.remote_addr
                                request_uri     = ngx.var.request_uri                             
                                domain          ="testiq.vn"
                                if (cookie_erandom == nil) then
                                        return ngx.redirect("/auth?m=er&dm=testiq.vn&url=" .. request_uri)
                                end
                                local etoken = ngx.md5(testiq .. remote_addr .. cookie_erandom)
                                if (cookie_etoken ~= etoken) then
                                        return ngx.redirect("/auth?m=et&dm=testiq.vn&url=" .. request_uri)
                                end
                        }  
.....
}

When request go thought, some time it have been processed by other  server lua block, and the other muacard.vn, have same problem, too. I have not meet this problem on old version before
curl -I https://testiq.vn/
HTTP/1.1 302 Moved Temporarily
Date: Sat, 24 Nov 2018 18:20:08 GMT
Content-Type: text/html
Content-Length: 160
Connection: keep-alive
Location: /auth?m=er&dm=muacard.vn&url=/ 
Server: HCM
Cache-Control: public

curl -I https://muacard.vn/
HTTP/1.1 302 Moved Temporarily
Date: Sat, 24 Nov 2018 18:20:08 GMT
Content-Type: text/html
Content-Length: 160
Connection: keep-alive
Location: /auth?m=er&dm=testiq.vn&url=/ 
Server: HCM
Cache-Control: public
Reply all
Reply to author
Forward
0 new messages