0

Is there a way in Nginx to serve always static file specified in root except for the case when request is matched according to some criteria (i.e. specified header) in which case it would be passed to an upstream ?

ps-aux
  • 101
  • 2

1 Answers1

0

I believe something like this would work, obviously you'd have to flesh out your the proxy section. You could also wrap the if block in a location block.

   ...
    root /path/to/static/content;
    index static_content.html;

    if($http_x_yourheader_here) {
        proxy_pass upstream_addr;
    }
    ...
Joe Brailsford
  • 1,181
  • 8
  • 10