openresty / encrypted-session-nginx-module

encrypt and decrypt nginx variable values
http://openresty.org
195 stars 52 forks source link

"set_decrypt_session" not working, got empty string. openresty bundle 1.15.8.1 #20

Open cqlangyi opened 5 years ago

cqlangyi commented 5 years ago

good day,

when running demo encrypt/decrypt shown in project home, "set_decrypt_session" could not decrypt session, always got empty string.

location /encrypt {
    set $raw 'text to encrypted'; # from the ngx_rewrite module
    set_encrypt_session $session $raw;
    set_encode_base32 $session; # from the ngx_set_misc module

    add_header Set-Cookie 'my_login=$session';  # from the ngx_headers module

    # your content handler goes here...
}
location /decrypt {
    set_decode_base32 $session $cookie_my_login; # from the ngx_set_misc module
    set_decrypt_session **_$raw_** $session;

    if ($raw = '') {
        # bad session
    }

    # your content handler goes here...
}

the "$raw" is always empty string.

centos 7.4 openresty 1.15.8.1

thank you for the help.