Odoo is the world's easiest all-in-one management software. It includes hundreds of business apps:
CRM | e-Commerce | Accounting | Inventory | PoS | Project management | MRP | etc.
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.
About This Community
This platform is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.Register
Odoo Training Center
Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.Test it now
|Asked: 1/20/15, 3:57 AM|
|Seen: 2775 times|
|Last updated: 10/12/16, 10:43 AM|