Project

General

Profile

[Solved] get reverse proxy config working

Added by dev004 5 months ago

For a project i wanted to setup a reverse proxy in the lighttpd config.

The idea is this:
files hosted onto domainY/x/y/z
Main application hosted onto domainX

What we want to achieve is the following.
Files urls are coded by domainX/ourfiles/x/y/z (x/y/z are extra folders / querystring params)

So we wanted to setup a reverse proxy for lighttpd to proxing requests from domainX/ourfiles => domainY/

What i already tested:
1:

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

2:

# Matching Proxy
$HTTP["url"] =~ "(^/ourfiles/)" {
    proxy.server  = ("" => (
        ("host" => "127.0.0.1", "port" => 82)
    ))
}

# URL Rewriting Proxy
$SERVER["socket"] == ":82" {
  url.rewrite-once = ( "^/ourfiles/(.*)$" => "/$1" )
  proxy.server  = ("" => (
         ("host" => "domainX", "port" => 80)
     ))
}

The first aproach doesn't do anything,
The 2nd one shows a redirect into the chrome dev tools.
But ending with broken link / image.


Replies (1)

RE: get reverse proxy config working - Added by gstrauss 5 months ago

Please see the documentation for mod_proxy
It sounds like you might want to look at "map-urlpath"

    (1-1/1)