Project

General

Profile

Actions

Bug #1206

closed

mod_proxy_core fails to rewrite proxy URL [fixed => ADD TO TRUNK!]

Added by quietdragon over 17 years ago. Updated about 16 years ago.

Status:
Fixed
Priority:
Urgent
Category:
mod_proxy_core
Target version:
ASK QUESTIONS IN Forums:

Description

I built http://www.lighttpd.net/download/lighttpd-1.5.0-r1857.tar.gz and
I'm trying to follow the instructions at:

http://blog.lighttpd.net/articles/2006/07/18/reverse-proxying-mod_proxy_core

The lighttpd.conf I'm using is below. I've started a Mongrel session at
localhost:3000, and when I browse to http://localhost/proxy, Mongrel
tells me:


Processing SiteController#show_page (for 192.168.1.17 at 2007-05-30 08:58:20) [GET]
  Parameters: {"url"=>["proxy"], "action"=>"show_page", "controller"=>"site"}
Completed in 0.74100 (1 reqs/sec) | DB: 0.02960 (3%) | 404 Not Found  [http://localhost/proxy]

{{{ 404 Not Found http://localhost/proxy }}} ???

The proxy-core.rewrite-request should have stripped the /proxy/ header
from the URI.

I've even tried:

{{{ "_uri" => ( "^(.*)" => "/" ), }}}

with no effect.


server.username             = "lighttpd" 
server.groupname            = "lighttpd" 

server.modules           = ( "mod_rewrite",
                             "mod_alias",
                             "mod_accesslog",
                             "mod_proxy_core",
                             "mod_proxy_backend_http" )

server.errorlog          = "/var/log/lighttpd/error_log" 
accesslog.filename       = "/var/log/lighttpd/access_log" 

server.document-root     = "/home/www/localhost/" 

$HTTP["url"] =~ "^/proxy(/|$)" {

        proxy-core.rewrite-response = (
            "_uri" => ( "^/(.*)" => "/proxy/$1" ),
        )
        proxy-core.rewrite-request = (
            "_uri" => ( "^/proxy/?(.*)" => "/$1" ),
            "Host" => ( ".*" => "localhost:3000" )
        )

        proxy-core.balancer = "round-robin" 
        proxy-core.protocol = "http" 
        proxy-core.backends = ( "localhost:3000" )
        proxy-core.max-pool-size = 1
}

Files

lighttpd.diff (390 Bytes) lighttpd.diff tx, 2007-05-31 15:21
mod_proxy_core.patch (632 Bytes) mod_proxy_core.patch -- rush Anonymous, 2007-09-25 18:10

Related issues 1 (0 open1 closed)

Is duplicate of Bug #1600: proxy-core.rewrite-request never works (error in mod_proxy_core.c)FixedActions
Actions #1

Updated by tx over 17 years ago

I have similar problem too

partial lighttpd.conf:


$HTTP["url"] =~ "^/$" {
   proxy-core.balancer       = "round-robin" 
   proxy-core.protocol       = "http" 
   proxy-core.backends          = ( "google.com" )
}

error.log


response.c.165: (trace) run condition:
response.c.217: (trace) -- splitting Request-URI
response.c.218: (trace) Request-URI  : /
response.c.219: (trace) URI-scheme   : http
response.c.220: (trace) URI-authority: xxx.xx
response.c.221: (trace) URI-path     : /
response.c.222: (trace) URI-query    : (null)
response.c.276: (trace) -- sanitizing URI
response.c.277: (trace) URI-path     : /
configfile-glue.c.500: (trace) === start of 1 condition block ===
configfile-glue.c.450: (trace) 'HTTP["url"]': '/' is matched against '^/$'
configfile-glue.c.521: (trace) [1] result: true
mod_access.c.138: (trace) -- handling file in mod_access
response.c.393: (trace) -- before doc_root
response.c.394: (trace) Doc-Root     : /var/www/
response.c.395: (trace) Rel-Path     : /
response.c.396: (trace) Path         : /var/www
response.c.449: (trace) -- after doc_root
response.c.450: (trace) Doc-Root     : /var/www/
response.c.451: (trace) Rel-Path     : /
response.c.452: (trace) Path         : /var/www
mod_proxy_core.c.2180: (trace) handling it in mod_proxy_core: uri.path=/
response.c.471: (trace) -- logical -> physical
response.c.472: (trace) Doc-Root     : /var/www/
response.c.473: (trace) Rel-Path     : /
response.c.474: (trace) Path         : /var/www
plugin.c.387: (trace) -- plugins_call_...: plugin 'mod_proxy_core' returns 4
plugin.c.387: (trace) -- plugins_call_...: plugin 'mod_proxy_core' returns 4
plugin.c.387: (trace) -- plugins_call_...: plugin 'mod_proxy_core' returns 4
Actions #2

Updated by Anonymous over 17 years ago

the same regarding me...

-- rgut

Actions #3

Updated by Anonymous over 17 years ago

dupa

Actions #4

Updated by tx over 17 years ago

after some investigation i found
r1838 commit was breaking proxy-core.rewrite-request

test configuration


$HTTP["url"] =~ "^/proxy($|/)" {
        proxy-core.protocol = "http" 
        proxy-core.balancer = "static" 
        proxy-core.backends = ( "yahoo.com" )
        proxy-core.rewrite-request = (
                "_uri" => ( "/proxy/?(.*)" => "/$1" ),
                "Host" => ( ".*" => "yahoo.com"),
        )
}

atached patch fixes it

Actions #5

Updated by robert over 17 years ago

imho wrong way... after successfully pcre_replace we are copying p->replace_buf into sess->request_uri but... later in the same file we are overwritting sess->request_uri (using con->request.uri). so, i think copying into sess->request_uri is a mistake.

Actions #6

Updated by Anonymous about 17 years ago

Hi, I think this bug should be fixed this way. See mod_proxy_core.patch

-- rush

Actions #7

Updated by Anonymous almost 17 years ago

Would someone please - for gods sake - submit this patch to the trunk?

-- djunky

Actions #8

Updated by Anonymous almost 17 years ago

don't worry yourself... lighttpd is abandonware now

Actions #9

Updated by Anonymous almost 17 years ago

Please please please add mod_proxy_core.patch to the trunk.

-- bdferris

Actions #10

Updated by stbuehler almost 17 years ago

Another possibility would be to write the rewrite-result back into con->request.uri; but either way it should be fixed.

Hint for the future: add "patch" to the keywords.

Actions #11

Updated by stbuehler about 16 years ago

  • Status changed from New to Assigned
  • Assignee changed from jan to stbuehler
  • Pending changed from Yes to No
  • Patch available set to Yes
Actions #12

Updated by stbuehler about 16 years ago

  • Status changed from Assigned to Fixed
  • % Done changed from 0 to 100
  • Patch available changed from Yes to No

Fixed in r2146

Actions

Also available in: Atom