List Info

Thread: HTTP_REFERER + apache + mongrel_cluster




HTTP_REFERER + apache + mongrel_cluster
country flaguser name
Germany
2007-05-10 08:14:09
Hi, I'm using configuration Apache 2.2 + Mongrel cluster
and I can not obtain information in my Rails app from
request.env["HTTP_REFERER"]

Does anybody know how to setup apache.conf to pass http
referer to
mongrel cluster.
This works for webrick but not in Apache+mongrel_cluster
configuration.

This is my current apache conf.

<VirtualHost 192.168.1.5>
  ServerName domain.com
  #NameVirtualHost domain.com
  ServerAlias www.domain.com

  DocumentRoot /var/www/apps/domain.com/current/public

  # I use utf-8 for all my projects, so I force apache to
send the good
charset by default.
  # This is needed if you use page caching and want apache
serves these
with the good charset.
  #
  AddDefaultCharset utf-8

  # Do not allow open proxying, allow only requests starting
with a /
  <LocationMatch "^[^/]">
      Deny from all
  </LocationMatch>

  # Avoid open you server to proxying
  ProxyRequests Off

  # Let apache pass the original host not the ProxyPass one
  ProxyPreserveHost On

  <Directory
/var/www/apps/lovcicen_frontend/current/public>
    Options FollowSymLinks
    AllowOverride None
    Order allow,deny
    Allow from all
  </Directory>

  # Configure mongrel_cluster
  <Proxy balancer://lovcicen_frontend_cluster>
    BalancerMember http://127.0.0.1:8005
    BalancerMember http://127.0.0.1:8006
</Proxy>


  RewriteEngine On
...
...

-- 
Posted via http://www.ruby-forum.com
/.

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the
Google Groups "Deploying Rails" group.
To post to this group, send email to
rubyonrails-deploymentgooglegroups.com
To unsubscribe from this group, send email to
rubyonrails-deployment-unsubscribegooglegroups.com
For more options, visit this group at http://groups.google.com/group/rubyonrails-deployment
?hl=en
-~----------~----~----~----~------~----~------~--~---


Re: HTTP_REFERER + apache + mongrel_cluster
user name
2007-05-11 16:18:56
It's not exactly the answer you need, but I had to figure out something similar for REMOTE_USER and eventually ended up with:

&nbsp; &nbsp; &nbsp;   ; &nbsp; &nbsp; &nbsp;  RewriteEngine On
 &nbsp;   ; &nbsp; &nbsp; &nbsp; &nbsp;   RewriteCond %{LA-U:REMOTE_USER} (.+)
&nbsp; &nbsp; &nbsp;   ; &nbsp; &nbsp; &nbsp;  RewriteRule . - [E=RU:%1]
  ; &nbsp; &nbsp; &nbsp; &nbsp;   ; &nbsp; RequestHeader add X-Forwarded-User %e

So replace REMOTE_USER with HTTP_REFERER and X-Forwarded-User with X-Forwarded-Referer (or whatever).

You may not even need to get this fancy, as REMOTE_USER is somewhat special and you need some extra mod_rewrite voodoo to get it early enough.

Your app will need to be able to deal w/ either request.env["HTTP_REFERER&quot;] or request.env["HTTP_X_FORWARDED_REFERER"]

On 5/10/07, Petr Petr < ruby-forum-incomingandreas-s.net">ruby-forum-incomingandreas-s.net > wrote:

Hi, I'm using configuration Apache 2.2 + Mongrel cluster
and I can not obtain information in my Rails app from
request.env["HTTP_REFERER&quot;]

Does anybody know how to setup apache.conf to pass http referer to
mongrel cluster.
This works for webrick but not in Apache+mongrel_cluster configuration.

This is my current apache conf.

&lt;VirtualHost 192.168.1.5>
&nbsp; ServerName domain.com
 &nbsp;#NameVirtualHost domain.com
 &nbsp;ServerAlias www.domain.com

&nbsp; DocumentRoot /var/www/apps/domain.com/current/public

&nbsp; # I use utf-8 for all my projects, so I force apache to send the good
charset by default.
&nbsp; # This is needed if you use page caching and want apache serves these
with the good charset.
&nbsp; #
 &nbsp;AddDefaultCharset utf-8

&nbsp; # Do not allow open proxying, allow only requests starting with a /
 &nbsp;<LocationMatch "^[^/]">
 &nbsp; &nbsp; &nbsp;Deny from all
  </LocationMatch>

&nbsp; # Avoid open you server to proxying
&nbsp; ProxyRequests Off

 ; # Let apache pass the original host not the ProxyPass one
  ProxyPreserveHost On

  <Directory /var/www/apps/lovcicen_frontend/current/public>
&nbsp;   ;Options FollowSymLinks
   ; AllowOverride None
 ; &nbsp; Order allow,deny
 &nbsp; &nbsp;Allow from all
  </Directory&gt;

 &nbsp;# Configure mongrel_cluster
 ; <Proxy balancer://lovcicen_frontend_cluster>
  ; &nbsp;BalancerMember http://127.0.0.1:8005
 &nbsp; &nbsp;BalancerMember http://127.0.0.1:8006
</Proxy>


&nbsp; RewriteEngine On
...
...

--
Posted via http://www.ruby-forum.com/.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Deploying Rails"; group.
To post to this group, send email to rubyonrails-deploymentgooglegroups.com
To unsubscribe from this group, send email to rubyonrails-deployment-unsubscribegooglegroups.com
For more options, visit this group at http://groups.google.com/group/rubyonrails-deployment?hl=en
-~----------~----~----~----~------~----~------~--~---

[1-2]

about | contact  Other archives ( Real Estate discussion Medical topics )