1

I am deploying an application and a Wordpress installation on AWS. I have Wordpress set up under Apache on an EC2, and my application under Lighttpd, and I want to reverse-proxy Wordpress through the application node. This works fine, I just set up the reverse proxy in Lighttpd as so:

$HTTP["url"] =~ "^/blog" {
        proxy.server = (
                "/blog" => ( "blog" => ( "host" => "123.456.789.123", "port" => 80 ))
        )
}

url.rewrite-once = (
        "^(.*?)$" => "/index.php/$1"
)

However, the issue is in the rewrite. When I enable rewriting, it catches it before the reverse proxy, and routes to index.php on the application server. I need it to not rewrite if it's going to the blog. I tried various regex matches and other configurations, but I haven't been able to get it to support rewriting and proxying at the same time. How can this be done?

2 Answers 2

0

I'd say make your rewrite pattern ignore the paths that are pending for a proxying, but keep the config the same otherwise:

url.rewrite-once = (
    "^((?!/blog).*)$" => "/index.php/$1"
)
1
  • I tried that, but I couldn't get it to work. The answer I just posted worked.
    – Jonah
    Sep 12, 2012 at 22:34
0

I solved it by placing another rewrite entry to match "blog" before the index.php rewrite.

$HTTP["url"] =~ "^/blog" {
        proxy.server = (
                "/blog" => ( "blog" => ( "host" => "123.456.789.012", "port" => 80 ))
        )
}

url.rewrite-once = (
        "^/blog(.*)" => "$0",
        "^(.*?)$" => "/index.php/$1",
)

Since it's using rewrite-once, it will stop at the first match and let it fall through to the proxy server.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .