Proxy specific files only?

I’ve trying to get a specific use case workingas part of testing an external tool. I’m wondering if it’s possible ot match on a specific file extension and then proxy those requests

e.g. would be delivered as expected would be proxied as

I also attempted a rewrite

rewrite /tmp {
r ^/tmp(.*)$
to {1}
redir {
if {path} ends_with ts
but it wasn’t working for some reason

I’ve tried variations of the rewrite/redirect combo but haven’t been successful.

Try this, for example extensions .foo and .bar: {

  # Rewrite to prepend proxy path based on ext
  rewrite /tmp {
    ext .foo .bar
    to /proxy-foo-bar{uri}

  # Proxy from the specific path and strip out the prefix  
  proxy /proxy-foo-bar [upstream:port] {
    without /proxy-foo-bar/tmp


This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.