Home > Uncategorized > Squid, CherryPy and OpenERP

Squid, CherryPy and OpenERP

Squid (software)

Image via Wikipedia

This is going to be quick…

Squid and CherryPy (therefore the web client of OpenERP) do not get along pretty well. Reason being CherryPy expects to know the originating URL by reading the http “X-Forwarded-Host” header. The only reverse proxies that add this header are Apache (mod_proxy) and Lighttp. This does not happen with Squid. Actually it does, but this information is published under the variable “Origin”. The result is in order to integrate CherryPy with Squid, you need to modify a little bit the CherryPy code.

In the file lib/ctools.py, located under the root of CherryPy (v3) you can find the proxy function. Just by setting the input variable of the “local” function, which is set by default in “X-Forwarded-Host”, to “Origin” is enough. And doing so you will be able to save a lot of time (in my case 4 hours) and trouble.

You might wonder why you need this, just in case you need to work  with OpenERP behind a reverse proxy like Squid.


  1. June 12, 2011 at 2:39 pm

    You don’t want to modify the source code itself but rather set that value when enabling the tool from your configuration:

    tools.proxy.on: True
    tools.proxy.local: ‘Origin’

  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: