# Cartographer/google maps and apache2/mongrel problem

**URL:** <https://www.ruby-forum.com/t/cartographer-google-maps-and-apache2-mongrel-problem/103305>\
**Category:** Rails\
**Created:** [May 4, 2007, 1:00am UTC](https://www.ruby-forum.com/t/cartographer-google-maps-and-apache2-mongrel-problem/103305 "2007-05-04T01:00:19Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![paul-au](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/f475e1/32.png) [@paul-au](https://www.ruby-forum.com/u/paul-au)\
**Post date:** [May 4, 2007, 1:00am UTC](https://www.ruby-forum.com/t/cartographer-google-maps-and-apache2-mongrel-problem/103305/1 "2007-05-04T01:00:19Z")

</div>

Hi,

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 #127.0.0.1 pid\_file: log/mongrel.pid servers: 1

and my apache2 config:

\<\<-=======================================  
\<VirtualHost \*:80\>  
ProxyPreserveHost On  
ProxyPass / [http://localhost:10010/](http://localhost:10010/)  
ProxyPassReverse / [http://localhost:10010/](http://localhost:10010/)  
ServerName [my.domain.net](http://my.domain.net)  
#Fix for Apache bug 39499  
SetEnv force-proxy-request-1.0 1  
SetEnv proxy-nokeepalive 1

Listen localhost:10010  
  
ServerName [my.domain.net](http://my.domain.net)  
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/  
mongrel\_cluster/common.conf

# \<Proxy balancer://mongrel\_cluster\> BalancerMember [http://localhost:10011](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/mongrel.pid servers: 1

with a registered api key “[my.domain.net:10011](http://my.domain.net:10011)”, and bypassing  
apache2 works.

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

TIA,  
Paul

---

<div class="post-metadata">

**Author:** ![paul-au](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/f475e1/32.png) [@paul-au](https://www.ruby-forum.com/u/paul-au)\
**Post date:** [May 4, 2007, 5:28pm UTC](https://www.ruby-forum.com/t/cartographer-google-maps-and-apache2-mongrel-problem/103305/2 "2007-05-04T17:28:55Z")

</div>

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/  
header.rb:

# \<\<=== def self.header\_for(request, version=2) mh = self.new 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 mh.to\_s end
