# Proxy.server and url.rewrite-once

**URL:** <https://www.ruby-forum.com/t/proxy-server-and-url-rewrite-once/49128>\
**Category:** Rails\
**Created:** [November 30, 2005, 10:45am UTC](https://www.ruby-forum.com/t/proxy-server-and-url-rewrite-once/49128 "2005-11-30T10:45:22Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [November 30, 2005, 10:45am UTC](https://www.ruby-forum.com/t/proxy-server-and-url-rewrite-once/49128/1 "2005-11-30T10:45:22Z")

</div>

i have a very simple lighttpd config that just forwards with mod\_proxy  
some requests to different hosts lixe this:

server.modules = ( “mod\_proxy”, “mod\_rewrite” )

server.port = 80  
server.pid-file = “/var/run/lighttpd.pid”  
server.errorlog = “/var/log/lighttpd-err.log”  
server.document-root = “/var/www/htdocs/”

$HTTP[“url”] =~ “^/simons\_app” {  
url.rewrite-once = ( “” =\> “” ) # \<= WHAT SHOULD I WRITE HERE?  
proxy.server = ( “” =\> ( ( “host” =\> “10.0.0.12”,  
“port” =\> 3000 )  
)  
)  
}

$HTTP[“url”] =~ “^/marks\_app” {  
url.rewrite-once = ( “” =\> “” ) # \<= WHAT SHOULD I WRITE HERE?  
proxy.server = ( “” =\> ( ( “host” =\> “10.0.0.15”,  
“port” =\> 3000 )  
)  
)  
}

so when a request comes in with an url like  
[http://www.example.com/marks\_app/people](http://www.example.com/marks_app/people)  
it is forwarded to 10.0.0.15:3000/marks\_app/people  
this does not work because i get a routing error from the rails app (the  
“marks\_app” controller does not exist), therefore i’d like to get rid of  
the “marks\_app” part in the url before routing the request to the  
correct server. can i do this with url.rewrite-once? how?

---

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [November 30, 2005, 7:49pm UTC](https://www.ruby-forum.com/t/proxy-server-and-url-rewrite-once/49128/2 "2005-11-30T19:49:05Z")

</div>

On Nov 30, 2005, at 1:41 AM, Simon S. wrote:

> i have a very simple lighttpd config that just forwards with mod\_proxy  
> some requests to different hosts lixe this:

Simon-

```
You need to make sure you are running the latest lighttpd 1.4.8 and

```

then follow these instructions. This feature was just added to lighty  
and it does exactly what you are looking for:

[http://blog.lighttpd.net/articles/2005/11/23/lighttpd-1-4-8-and-](http://blog.lighttpd.net/articles/2005/11/23/lighttpd-1-4-8-and-)  
multiple-rails-apps

Cheers-  
-Ezra Z.  
Yakima Herald-Republic  
WebMaster  
[http://yakimaherald.com](http://yakimaherald.com)  
509-577-7732  
removed\_email\_address@domain.invalid
