Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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
add comment

1 Answer

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
add comment

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.