How can i set max_age=7200, secure=True, httponly=True in the openerp cookie ?
I have tried to put this attributes as follow:
if hasattr(response, 'set_cookie'):
response.set_cookie('sid', value=session.sid, max-age=7200, secure=True, httponly=True)
but always the system raise Session Expired Execption.
How can i set these parameters and what is the best way to set it on the NGINX web server or as the way i tried above. ?
Thank you @Hardikgiri Goswami for your quick reply of course i have searched about how to set cookie in python using werkzeug lib as follow ( set_cookie(key, value='', max_age=None, expires=None, path='/', domain=None,secure=None, httponly=False) )
and for more info about werkzeug you can see this link http://werkzeug.pocoo.org/docs/0.9/
what i have done is:
response.set_cookie('sid', session.sid, max_age=2*3600, expires=int(time.time())+2*3600, httponly=True)
and this works fine.
What i want to know exactly which way is the best for setting cookie parameters specially in OPENERP like what i did using http.py file or using NGINX reverse proxy like the answer mentioned by @rrehbein in this link http://serverfault.com/questions/278319/how-to-rewrite-the-domain-part-of-set-cookie-in-a-nginx-reverse-proxy.
To know more and more about cookies review this very helpful links:
I don't know exaclty what is obstacle for you.
But I have seen example of set_cookie in odoo/openerp/http.py line no 1338.
response.set_cookie('session_id', httprequest.session.sid, max_age=90 * 24 * 60 * 60)
and by searching the string "python response.set_cookie" and found the following link might be use full.
Hope this might be helpful to you.
Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!
About This Community
|Asked: 1/20/15, 3:57 AM|
|Seen: 1474 times|
|Last updated: 10/12/16, 10:43 AM|