https://redmine.lighttpd.net/https://redmine.lighttpd.net/favicon.ico?13667327412005-06-29T16:09:09Zlighty labsLighttpd - Bug #164: mod_proxy and mod_rewrite inside the same URL conditional?https://redmine.lighttpd.net/issues/164?journal_id=3682005-06-29T16:09:09Zjan
<ul><li><strong>Status</strong> changed from <i>New</i> to <i>Assigned</i></li></ul> Lighttpd - Bug #164: mod_proxy and mod_rewrite inside the same URL conditional?https://redmine.lighttpd.net/issues/164?journal_id=3692005-12-23T06:06:37ZAnonymous
<ul></ul><p>I'm having this problem too. See <a class="external" href="http://forum.lighttpd.net/topic/69">http://forum.lighttpd.net/topic/69</a></p>
<p>-- ryan at art of mission dot com</p> Lighttpd - Bug #164: mod_proxy and mod_rewrite inside the same URL conditional?https://redmine.lighttpd.net/issues/164?journal_id=3702006-02-09T00:56:43Zconny
<ul></ul><p>I created a pair of extra testcases for "url.rewrite inside $HOST[]".</p> Lighttpd - Bug #164: mod_proxy and mod_rewrite inside the same URL conditional?https://redmine.lighttpd.net/issues/164?journal_id=3712006-02-09T13:59:01Zconny
<ul></ul><p>But wait a moment... The first case described in the ticket <em>is</em> a bit odd nevertheless:</p>
<p>You rewrite "!^/projects/csFOO" to "/FOO", after which there are two possible outcomes:</p>
<ol>
<li>After the rewrite we're "back at the start" so to say: the consecutive pass does NOT match the $HOST<a class="wiki-page new" href="https://redmine.lighttpd.net/projects/lighttpd/wiki/Url">url</a> specified ("/FOO" !~ ""!^/projects/cs(.*)" and therefore handled by the outside context instead (not proxied).</li>
</ol>
<ol>
<li>Proxied requests are always handled directly after rewrites. So in this case "/FOO/" is proxied to "http://127.0.0.1:9090/FOO"</li>
</ol>
<p>The current documentation does not specify which case is supposed to happen.</p> Lighttpd - Bug #164: mod_proxy and mod_rewrite inside the same URL conditional?https://redmine.lighttpd.net/issues/164?journal_id=3722006-02-09T14:11:29Zconny
<ul></ul><p>With neither clear documentation nor a test unit for mod_proxy available at the moment: just <strong>stick to the alternative without conditionals</strong>.</p>
<p>It <em>is</em> really confusing to say in effect "for stuff matching /FOO: proxy everything to 127.0.0.1:9090 that matches /*everything*". Huh?!</p> Lighttpd - Bug #164: mod_proxy and mod_rewrite inside the same URL conditional?https://redmine.lighttpd.net/issues/164?journal_id=3732006-06-06T00:41:02ZAnonymous
<ul></ul><p>re: using the alternative without conditionals, there is value in doing it the first way.</p>
<p>Say I want to serve normal html pages but all requests to /myappserver need to be redirected.</p>
<p>Now say that the app server wants a clean URL, e.g. instead of /myappserver/foo going to the app server it's /foo.</p>
<p>In apache this functionality is achieved by</p>
<pre>
RewriteRule ^myappserver/(.*)$ http://localhost:2323/$1 [P]
</pre>
<p>There are work arounds but it would be nice to map urls cleanly.</p>
<p>-- weeksie</p> Lighttpd - Bug #164: mod_proxy and mod_rewrite inside the same URL conditional?https://redmine.lighttpd.net/issues/164?journal_id=3742007-04-16T07:18:46Zjan
<ul><li><strong>Status</strong> changed from <i>Assigned</i> to <i>Fixed</i></li><li><strong>Resolution</strong> set to <i>fixed</i></li></ul><p>such rewrites are supported by mod-proxy-core in 1.5.0 with proxy-core.rewrite-request.</p> Lighttpd - Bug #164: mod_proxy and mod_rewrite inside the same URL conditional?https://redmine.lighttpd.net/issues/164?journal_id=52742009-02-02T18:57:19Zcstefkivoila
<ul></ul><p>jan wrote:</p>
<blockquote>
<p>such rewrites are supported by mod-proxy-core in 1.5.0 with proxy-core.rewrite-request.</p>
</blockquote>
<p>Hello,</p>
<p>I have the same problem than above.<br />Indeed, I want to achieve the following Apache line with lighttpd:<br /><code>RewriteRule ^myappserver/(.*)$ http://localhost:2323/$1 [P]</code></p>
<p>I am currently using lighttpd 1.4.20 on a DNS-323.<br />It is technically difficult to upgrade my lighttpd to the 1.5.0 release.<br />So my question is:<br />"Is there a work around of this problem for a 1.4 release of lighttpd?"</p>
<p>Thanks in advance for your help!</p> Lighttpd - Bug #164: mod_proxy and mod_rewrite inside the same URL conditional?https://redmine.lighttpd.net/issues/164?journal_id=76492011-11-04T23:05:45Zstefan
<ul></ul><p>Hi,</p>
<p>here is a workaroud I used to map an web-application on <a class="external" href="http://localhost:8008/">http://localhost:8008/</a> (its contextroot wasn't changable by configuration)<br />to <a class="external" href="http://webserver/myapp">http://webserver/myapp</a>. The idea behind this was to do the proxying and URL rewriting inside a separate lighttpd-instance<br />listening on a port not being port 80 (here: port 81). This separate instance is then accessed by a lighttpd instance listening on port 80 and using<br />mod_proxy. Here is the config I used:</p>
<pre>
# Part for proxy listening on port 80
$HTTP["url"] =~ "(^/webapp/)" {
proxy.server = ( "" => (
"webapp:80" => # name
( "host" => "127.0.0.1",
"port" => 81
)
)
)
}
# Part for proxy listening on port 81
$SERVER["socket"] == ":81" {
url.rewrite-once = ( "^/webapp/(.*)$" => "/$1" )
proxy.server = ( "" => (
"webapp:81" => # name
( "host" => "127.0.0.1",
"port" => 8008
)
)
)
}
</pre>
<p>Hope this helps someone.</p> Lighttpd - Bug #164: mod_proxy and mod_rewrite inside the same URL conditional?https://redmine.lighttpd.net/issues/164?journal_id=103852016-08-03T12:44:03Zflynn
<ul></ul><p>Although I used this "double" proxy solution for many years, I searched for better solution.</p>
<p>Here is my new approach with lua/mod_magnet:</p>
<pre>
$HTTP["url"] =~ "^/webapp/" {
magnet.attract-raw-url-to = ( "/etc/lighttpd/lua/webapp.lua" )
proxy.server = ( "" => ("webapp" => ("host" => "127.0.0.1", "port" => 8008)))
}
</pre>
<p>and /etc/lighttpd/lua/webapp.lua:</p>
<pre>
lighty.env["request.uri"] = string.sub(lighty.env["request.uri"], string.len('/webapp/'))
return
</pre>
<p>This is very close to the original request ...</p> Lighttpd - Bug #164: mod_proxy and mod_rewrite inside the same URL conditional?https://redmine.lighttpd.net/issues/164?journal_id=111942017-11-19T16:04:32Zgstrauss
<ul><li><strong>Description</strong> updated (<a title="View differences" href="/journals/11194/diff?detail_id=9730">diff</a>)</li></ul><p>FYI: lighttpd 1.4.46 introduces <code>proxy.header</code> which performs limited URL-prefix rewriting. More info at <a class="wiki-page" href="https://redmine.lighttpd.net/projects/lighttpd/wiki/Docs_ModProxy">Docs_ModProxy</a></p>