Project

General

Profile

Actions

Feature #926

closed

Rewrite + Proxy

Added by Anonymous over 18 years ago. Updated over 16 years ago.

Status:
Invalid
Priority:
Normal
Category:
mod_rewrite
Target version:
-
ASK QUESTIONS IN Forums:

Description

It would be very nice if mod_proxy_core and mod_rewrite could be used together, i.e. to rewrite the request on the back-end server.

proxy's lighttpd.conf:


$HTTP["url"] =~ "^/motoko/" {
  url.rewrite-once = ( "^/motoko(/.*)?" => "/caio/$1" )
  proxy-core.backends = ( "myip" )
}

Request:


elinks -dump http://mydomain/motoko/3

Log of proxed web server:


proxyip mydomain - [29/Nov/2006:13:24:03 +0100] "GET /motoko/3 HTTP/1.0" 404 345 "-" "ELinks/0.11.1 (textmode; FreeBSD 6.1-STABLE i386; -)" 

What I would like is a request to `/caio/3`.

Actions #1

Updated by darix over 18 years ago

  • Status changed from New to Fixed
  • Resolution set to invalid

thats expected. the original request path is logged. you should use redirect if you want to see the "rewritten" path.

Actions #2

Updated by darix over 18 years ago

  • Status changed from Fixed to Need Feedback
  • Resolution deleted (invalid)

Replying to darix:

thats expected. the original request path is logged. you should use redirect if you want to see the "rewritten" path.

hrm i shouldnt close bugs while waking up. :| of course on the backend you should see the changed request.

sorry

Actions #3

Updated by Anonymous over 18 years ago

BTW: using mod_proxy on latest 1.4 release is just the same as using mod_proxy_core as stated in the example (the back-end does not receive a rewritten request).

-- lapo

Actions #4

Updated by darix over 18 years ago

can you make sure mod_proxy is loaded after mod_rewrite/redirect?

Actions #5

Updated by Anonymous over 18 years ago

I wouldn't know how to alter the load order, except that lighttpd.conf includes the modules in this order:


server.modules = (
    "mod_rewrite",
    "mod_access",
    "mod_proxy_core",
    "mod_accesslog" 
)

-- lapo

Actions #6

Updated by jakabosky over 18 years ago

Try this:


$HTTP["url"] =~ "^/motoko/" {
    proxy-core.balancer = "round-robin" 
    proxy-core.protocol = "http" 
    proxy-core.backends = ( "myip" )
    proxy-core.rewrite-request = (
       "_uri" => ( "^/motoko(/.*)?" => "/caio/$1" )
    )
}

If you still have problem enable this:


debug.log-request-handling = "enable" 

Also I think url.rewrite work on the request uri before the $HTTPurl conditional matching.

enable log-request-handling with your config to see what it is doing.

Actions #7

Updated by stbuehler over 16 years ago

  • Status changed from Need Feedback to Fixed
  • Resolution set to invalid

Expected: mod_rewrite restarts a request and resets the conditional results.

Actions #8

Updated by stbuehler over 16 years ago

  • Status changed from Fixed to Invalid
Actions

Also available in: Atom