Cartographer/google maps and apache2/mongrel problem

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/
ProxyPassReverse / http://localhost:10010/
ServerName 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
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

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”, and bypassing
apache2 works.

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

TIA,
Paul

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

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