tgpfeiffer / restful-openerp

36 stars 13 forks source link

Set correct URL in responses when behind a reverse proxy #13

Closed tgpfeiffer closed 9 years ago

tgpfeiffer commented 9 years ago

At the moment, references to other resources are constructed using request.URLPath() which will fail when behind a reverse proxy. In particular, a web application that uses a proxy at http://localhost:6081 which proxies to http://oerp:8068 will find that responses start with http://localhost:8068, i.e., some weird combination of proxy's hostname and backend's port.

As outlined in http://twistedmatrix.com/documents/current/api/twisted.web.http.Request.html#setHost we should try to set hostname and port to the values specified in the Host header of the request.