proxypass from another host - type 'exceptions.TypeError'

Bug #522135 reported by Cédric Jeanneret deactivated on 2010-02-15
12
This bug affects 2 people
Affects Status Importance Assigned to Milestone
Odoo Web Client
Undecided
Unassigned

Bug Description

Hello,

We're trying to use the openerp webclient in this schema :

[Proxy server - Apache]
       |
[Openerp server - with openerp webclient]

Apache configuration on proxy :

<Proxy http://openerp-srv1.toto.com:8080/*>
  Order deny,allow
  Allow from all
</Proxy>

RewriteEngine On

RewriteCond %{HTTP_HOST} ^demo.titi.com$
RewriteCond %{HTTPS} off
RewriteRule ^/(.*)$ https://demo.titi.com/ [L]

RewriteCond %{HTTP_HOST} ^demo.titi.com$
RewriteRule ^/(.*)$ http://openerp-srv1.toto.com:8080/$1 [P,L]

Configuration for webclient on openerp-srv1 :

[global]
server.socket_host = "0.0.0.0"
server.socket_port = 8080
server.thread_pool = 10
server.environment = "development"
server.profile_on = False
server.profile_dir = "profile"

tools.proxy.on = True
#tools.proxy.base = '''

log.access_file = "/var/log/openerp-web/access.log"
log.error_file = "/var/log/openerp-web/error.log"

[openerp]
host = 'localhost'
port = '8070'
protocol = 'socket'

[openerp-web]
dblist.filter = 'EXACT'
dbbutton.visible = True
company.url = ''
child.listgrid.limit = 5
child.listgrid.min_rows = 5

What happens :

- We can log in, logout
- We can browse datas

- We CANNOT save anything. For example, when we modify a user's password, we have this error :

<type 'exceptions.TypeError'> Python 2.5.2: /usr/bin/python
Mon Feb 15 14:49:51 2010

A problem occurred in a Python script. Here is the sequence of function calls leading up to the error, in the order they occurred.
 /srv/openerp/instances/openerp_easy/src/web-client/lib/CherryPy-3.1.2-py2.5.egg/cherrypy/_cprequest.py in respond(self=<cherrypy._cprequest.Request object at 0x240fc10>, path_info='/')
 /srv/openerp/instances/openerp_easy/src/web-client/lib/CherryPy-3.1.2-py2.5.egg/cherrypy/_cpdispatch.py in __call__(self=<cherrypy._cpdispatch.LateParamPageHandler object at 0x240f850>)
 /srv/openerp/instances/openerp_easy/src/web-client/openerp/controllers/base.py in wrapper(*args=(), **kw={'context': '{%27lang%27:%20u%27fr_FR%27,%20%27tz%27:%20False...27active_ids%27:%20[33],%20%27active_id%27:%2033}', 'count': '1', 'domain': '[]', 'id': '1', 'ids': '[1]', 'limit': '80', 'model': 'res.users', 'offset': '0', 'search_domain': '', 'view_ids': '[5,%204]', ...})
  128 # User is logged in; allow access
  129 clear_login_fields(kw)
  130 return fn(*args, **kw)
  131 else:
  132 # User isn't logged in yet.
fn = <bound method Root.index of <openerp.controllers.root.Root object at 0x2294e50>>, args = (), kw = {'context': '{%27lang%27:%20u%27fr_FR%27,%20%27tz%27:%20False...27active_ids%27:%20[33],%20%27active_id%27:%2033}', 'count': '1', 'domain': '[]', 'id': '1', 'ids': '[1]', 'limit': '80', 'model': 'res.users', 'offset': '0', 'search_domain': '', 'view_ids': '[5,%204]', ...}
 /srv/openerp/instances/openerp_easy/src/web-client/openerp/tools/expose.py in func_wrapper(*args=(<openerp.controllers.root.Root object at 0x2294e50>,), **kw={'context': '{%27lang%27:%20u%27fr_FR%27,%20%27tz%27:%20False...27active_ids%27:%20[33],%20%27active_id%27:%2033}', 'count': '1', 'domain': '[]', 'id': '1', 'ids': '[1]', 'limit': '80', 'model': 'res.users', 'offset': '0', 'search_domain': '', 'view_ids': '[5,%204]', ...})
  202 def func_wrapper(*args, **kw):
  203
  204 res = func(*args, **kw)
  205
  206 if format == 'json' or (allow_json and 'allow_json' in cherrypy.request.params):
global res = '/srv/openerp/instances/openerp_easy/src/web-client/openerp/widgets/templates/viewform.mako', func = <function index at 0x229b848>, args = (<openerp.controllers.root.Root object at 0x2294e50>,), kw = {'context': '{%27lang%27:%20u%27fr_FR%27,%20%27tz%27:%20False...27active_ids%27:%20[33],%20%27active_id%27:%2033}', 'count': '1', 'domain': '[]', 'id': '1', 'ids': '[1]', 'limit': '80', 'model': 'res.users', 'offset': '0', 'search_domain': '', 'view_ids': '[5,%204]', ...}

<type 'exceptions.TypeError'>: index() got an unexpected keyword argument 'count'
      args = ("index() got an unexpected keyword argument 'count'",)
      message = "index() got an unexpected keyword argument 'count'"

What we tried :

- Disable tools.proxy.on : we cannot log out nor save stuff, we're redirected to the wrong server.
- Put an apache on openerp-srv1 with a simple proxypass, and setting up proxypass on demo.titi.com so that it uses apache on srv1. No chance - still crashing (same error).

We have seen that it seems to be the tools.proxy.on which causes this problem - deactivating it makes all work, except we're redirected to the wrong server while doing some stuff like logout, saving and so on....

NOTA: we cannot use tools.proxy.base, as we'll have many sub-domains (demo, client1, client2 and so on).

Any idea on how to correct it ?

Thanks in advance.

Best regards,

C.

Oh, by the way - client version :
checkout of branch: sftp://<email address hidden>/srv/bzr/easy_openerp/prod/webclient/
revno: 2801
tags: 5.0.7rc2
branch nick: 5.0
timestamp: Wed 2010-01-20 16:18:36 +0530

Regards,

C.

[I promise, last one for today]

we tried with the latest bzr+ssh://bazaar.launchpad.net/~openerp/openobject-client-web/5.0/

same problem.

Changed in openobject-client-web:
status: New → Confirmed
importance: Undecided → High
milestone: none → 5.0.7
Changed in openobject-client-web:
milestone: 5.0.7 → 5.0.8
Changed in openobject-client-web:
assignee: nobody → ame (Tiny) (ame-tiny)
Changed in openobject-client-web:
milestone: 5.0.8 → 5.0.9
Changed in openobject-client-web:
milestone: 5.0.9 → 5.0.10
Changed in openobject-client-web:
assignee: Amit Mendapara (amit-mendapara) → noz (Open ERP) (noz-tiny)
Changed in openobject-client-web:
milestone: 5.0.10 → 5.0.11
Changed in openobject-client-web:
milestone: 5.0.11 → 5.0.12
tags: added: maintenance
Changed in openobject-client-web:
assignee: noz (Open ERP) (noz-tiny) → Xavier (Open ERP) (xmo)
Amit Mendapara (cristatus) wrote :

Follow the instructions given here http://doc.openerp.com/install/linux/web/index.html#configure-https

We never tested apache rewrite extensions but normal reverse proxying with proxy pass works. The official demo is configured this way...

Finally got around to testing it, I am unable to reproduce the issue using 5.0.12.

I'm using a machine A and a VM B, A sees B as demo and B sees A as srv1 (via /etc/hosts files), the web client runs on A with the configuration

    [global]
    server.socket_host = "0.0.0.0"
    server.socket_port = 8080
    server.thread_pool = 10
    server.environment = "development"
    server.profile_on = False
    server.profile_dir = "profile"

    tools.proxy.on = True
    #tools.proxy.base = '''

    #log.access_file = "/var/log/openerp-web/access.log"
    #log.error_file = "/var/log/openerp-web/error.log"

    [openerp]
    host = 'localhost'
    port = '8070'
    protocol = 'socket'

    [openerp-web]
    dblist.filter = 'EXACT'
    dbbutton.visible = True
    company.url = ''
    child.listgrid.limit = 5
    child.listgrid.min_rows = 5

Apache runs on B with the configuration

    ProxyRequest On
    RewriteEngine On

    RewriteCond %{HTTP_HOST} ^demo$
    RewriteRule ^/(.*)$ http://srv1:8080/$1 [P,L]

    <Proxy http://srv1:8080/*>
      Order deny,allow
      Allow from all
    </Proxy>

Browser is launched from A and pointed to http://demo/, Apache logs on B (using RewriteLogLevel 9) show that the request goes through B, is matched, rewritten and send to the proxy. I do not get the error you demonstrate here (though I do get a slightly different issue that after edition the form redirections seem to setup the domain anew, and my browser gets sent to srv1:8080 instead of demo, which yields a host not found)

Changed in openobject-client-web:
status: Confirmed → Incomplete
Amit Mendapara (cristatus) wrote :

Xavier,

If your proxy does not add the X-Forwarded-Host header, set the `tools.proxy.base` to the base url with http scheme and public domain name. For example:

tools.proxy.base = 'https://sub.domain.com'

However, with the method we tried (as documented), Apache server added `X-Forwarded-Host` header. You can also you `RequestHeader` option to set this header if you don't want to touch the web client config.

Short of being able to properly reproduce this, I have to close this bug report (it should have expired automatically a long time ago).
By the way, unless we can trace an error cause to the web client doing something incorrect, issues with proxy configurations etc. can hardly be seen as bugs. Some could at best be seen as wishlist, e.g. when the web client could provide some additional help for such deployments (this last note concerns the importance, which was set to High - certainly unnecessary)

Thanks for your contributions and understanding!

Changed in openobject-client-web:
assignee: Xavier (Open ERP) (xmo) → nobody
importance: High → Undecided
status: Incomplete → Won't Fix
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers