Cartographer/google maps and apache2/mongrel problem


I’m trying to make cartographer/google maps work with an apache2/
mongrel setup.

It works fine with lighttpd/fastcgi, however maps don’t render with
the above setup.

I was wondering if anyone had any success trying this.

Here is what my mongrel configuration file looks like:


cwd: /home/paulm/rails_apps/myapp/current
port: “10011”
environment: staging
address: localhost #
pid_file: log/
servers: 1

and my apache2 config:

<VirtualHost *:80>
ProxyPreserveHost On
ProxyPass / http://localhost:10010/
ProxyPassReverse / http://localhost:10010/
#Fix for Apache bug 39499
SetEnv force-proxy-request-1.0 1
SetEnv proxy-nokeepalive 1

Listen localhost:10010

DocumentRoot /home/paulm/rails_apps/myapp/current/public

<Directory “/home/paulm/rails_apps/myapp/current/public”>
Options FollowSymLinks
AllowOverride None
Order allow,deny
Allow from all

Include /home/paulm/rails_apps/myapp/current/config/

<Proxy balancer://mongrel_cluster>
BalancerMember http://localhost:10011

I registered an api key for my domain put in the cartographer config
file, restarted the mongrel cluster and httpd and I get this when
looking at the produced html:


As a side note, I tried out this configuration:


cwd: /home/paulm/rails_apps/myapp/current
port: “10011”
environment: staging
pid_file: log/
servers: 1

with a registered api key “”, and bypassing
apache2 works.

So, I’m wondering if I’m missing some apache2 configuration magic here!


The problem is with cartographer. When it tries to lookup the api
key, it uses HTTP_HOST in the request. In this setup, its the mongrel.

Here is the fix for vendor/plugins/cartographer/lib/cartographer/

def self.header_for(request, version=2)
mh =
mh.version = version
#uri = request.request_uri
#uri = uri[0…uri.rindex(’/’)] if uri.rindex(’/’) < uri.length
mh.uri = request.env[‘HTTP_X_FORWARDED_HOST’].split(’,’)[0]
rescue request.env[“HTTP_HOST”] #+ uri

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs