Forum: Rails deployment HTTP_REFERER + apache + mongrel_cluster

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Petr P. (Guest)
on 2007-05-10 17:14
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
...
...
Benjamin Ritcey (Guest)
on 2007-05-12 01:19
(Received via mailing list)
It's not exactly the answer you need, but I had to figure out something
similar for REMOTE_USER and eventually ended up with:

                RewriteEngine On
                RewriteCond %{LA-U:REMOTE_USER} (.+)
                RewriteRule . - [E=RU:%1]
                RequestHeader add X-Forwarded-User %{RU}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"]
or @request.env["HTTP_X_FORWARDED_REFERER"]
This topic is locked and can not be replied to.