Rewrite URI for a specific ORIGIN


#1

Let’s say we have this set up:

IF
req.url ~ "^/testbucket/category/"
THEN
blah.origin.com/category/

Basically, substitute part of the URI.

I know I can override header, but this will not work because the header substitution happens before


#2

If I’m understanding you correctly, you want to use an alternate origin only if a particular path has been requested.
(I’m assuming the actual path **category** doesn’t really exist) As long as you can translate **category** into a rule that can be expressed as a regular expression then it can be done.

You’d create your new backend as per this doc but instead of using a condition that checks if the backend is healthy or not you’d use one that checked if the request was for a category. eg req.url ~ "^/testbucket(/\d+/.*)$" or similar, depending on what makes up the category path structure. You can then add a host header override with the same condition attached.

Is that what you were looking to do?