Move to next context when first context returns 404?

elos4

New Member
#1
In most webservers, it's possible to program the software in such a way that the server will look into more than one 'context' or 'location' if it cannot find the requested resource in the first context/location that matched. The only requirement is that there should be more than one match. It will look at the most specific match (or the one on top in some cases) and then move on to the less specific ones.

I see that OLS just returns a 404 if it cannot find the resource in the first context/location.

I've tried using various combinations of using multiple regexes, using only locations (url directories), mixing the two and so on, to no avail.

I am trying to deploy OLS on a reverse proxy, which contains a lot of static files. But in case a file is missing, I want it to fetch it from an HTTP proxy-backend, instead of returning a 404. Is it possible?

See the following example. I would like it to first look into the 'topic' folder, and if it cannot find it there, go fetch it from a proxy (mumb). Is it possible, or does it the process simply stop if it cannot find it in the first match? Also, where can I find a list of variables that I can use in the configuration files, such as $request_uri etc?

C-like:
docRoot                   /var/www/wordpress/
cgroups                   0

context /wp-includes/ {
  location                /var/www/wordpress/
  allowBrowse             1
}

context exp:^/(t-ter|s-jo)(-|/|_)([0-9]+)-(.*) {
  type                    redirect
  externalRedirect        1
  statusCode              301
  location                /$1/$3/$4
}

context exp:^/([0-9]+)/([0-9]+)/([0-9]+)/(.*) {
  type                    redirect
  externalRedirect        1
  statusCode              301
  location                /a/1/$4
}

context / {
  type                    proxy
  handler                 mumb
  addDefaultCharset       off
}

context /topic/ {
  type                    proxy
  handler                 mumb
  addDefaultCharset       off
}

context exp:^/topic/(.*) {
  location                /var/www/wordpress/wp-content/cache/supercache/sitename/topic/$1/index-https.html
  allowBrowse             1
  extraHeaders            Header add test blah

  rewrite  {

  }
  addDefaultCharset       off

  phpIniOverride  {

  }
}
 
Top