Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I need to send all CGI request to another server so I decided to use it with proxy. The problem is that I need to send the client IP to the server so I did the following configuration:

$HTTP["url"] =~ "cgi" {
    $HTTP["remoteip"] =~ "^(.*)$" {
        url.rewrite-once = ("^(.*)$" => "$1?myip=%1")
    }

    proxy.server     = (
                    "" =>
                 (
                   ( "host" => "XXX.XXX.XXX.XXX",
                     "port" => 80,
                   )
                 )
                )
}

the problem is that its not rewriting the URL.

share|improve this question
up vote 0 down vote accepted

Found: can't use rewrite inside a $HTTP["url"] comparation. the url condition must be inside the rewrite, like the configuration below

$HTTP["remoteip"] =~ "^(.*)$" {
    url.rewrite-once = ("^(.*cgi.*)$" => "$1?myip=%1")
}

$HTTP["url"] =~ "cgi" {
proxy.server     = (
                "" =>
             (
               ( "host" => "XXX.XXX.XXX.XXX",
                 "port" => 80,
               )
             )
            )
}
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.