openerp-india team mailing list archive
-
openerp-india team
-
Mailing list archive
-
Message #23848
[Bug 1065127] Re: dbfilter doesn't work in proxy configurations
Hi,
is this a major issue out there? We are moving to use db-filter so I'm
wondering if this is a problem with a recent openerp 7.0 nightly build?
--
You received this bug notification because you are a member of OpenERP
Indian Team, which is subscribed to OpenERP Server.
https://bugs.launchpad.net/bugs/1065127
Title:
dbfilter doesn't work in proxy configurations
Status in OpenERP Server:
Confirmed
Bug description:
First reported in https://bugs.launchpad.net/openobject-
server/+bug/940439/comments/6 by Alvar V. (alvar-vilu), but it's
actually a different bug than the one discussed there:
When OpenERP (at least 6.1+) is deployed behind a proxy, the dbfilter
option won't work.
This is due to openerp/addons/web/controllers/main.py (lines 136+)
doing:
def db_list(req):
dbs = []
proxy = req.session.proxy("db")
dbs = proxy.list()
h = req.httprequest.environ['HTTP_HOST'].split(':')[0]
d = h.split('.')[0]
r = req.config.dbfilter.replace('%h', h).replace('%d', d)
dbs = [i for i in dbs if re.match(r, i)]
return dbs
However, in proxy configs, it should user HTTP_X_FORWARDED_HOST as
filter.
This can easily be done by checking whether that var is in the
environ:
def db_list(req):
dbs = []
proxy = req.session.proxy("db")
dbs = proxy.list()
if 'HTTP_X_FORWARDED_HOST' in req.httprequest.environ:
h = 'HTTP_X_FORWARDED_HOST'
else:
h = 'HTTP_HOST'
h = req.httprequest.environ[h].split(':')[0]
d = h.split('.')[0]
r = req.config.dbfilter.replace('%h', h).replace('%d', d)
dbs = [i for i in dbs if re.match(r, i)]
return dbs
To manage notifications about this bug go to:
https://bugs.launchpad.net/openobject-server/+bug/1065127/+subscriptions
References