Paul Mylchreest
2007-May-03 22:58 UTC
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
</VirtualHost>
Listen localhost:10010
<VirtualHost 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
</Directory>
Include /home/paulm/rails_apps/myapp/current/config/
mongrel_cluster/common.conf
<Proxy balancer://mongrel_cluster>
BalancerMember http://localhost:10011
</Proxy>
</VirtualHost>
======================================
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:
<<-======================================<!-- Cartographer Header goes
here. The URI [localhost:10011]
couldn''t be found in your
cartographer-config.yml file. Please add it and your map
initialization code will
appear here. Otherwise, perhaps your YML is misformed -->
======================================
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
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---
Paul Mylchreest
2007-May-04 15:28 UTC
Re: Cartographer/google maps and apache2/mongrel problem [SOLVED]
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
==
On 3-May-07, at 18:58 , Paul Mylchreest wrote:
>
> 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
> </VirtualHost>
>
> Listen localhost:10010
> <VirtualHost 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
> </Directory>
>
> Include /home/paulm/rails_apps/myapp/current/config/
> mongrel_cluster/common.conf
>
> <Proxy balancer://mongrel_cluster>
> BalancerMember http://localhost:10011
> </Proxy>
> </VirtualHost>
> ======================================>
>
> 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:
>
> <<-======================================> <!-- Cartographer
Header goes here. The URI [localhost:10011]
> couldn''t be found in your
> cartographer-config.yml file. Please add it and your map
> initialization code will
> appear here. Otherwise, perhaps your YML is misformed -->
> ======================================>
>
> 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
>
> >
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---