Multiple conditions for Host


#1

If I have a host that isn’t the primary endpoint I can set up a condition for it. That’s fine.

However if I want to setup conditions for two different routes I can’t do that with a single host. I found out that one of my endpoints wasn’t working because creating a New (or selecting an existing) condition detached the previous one for the host. Is there a reason a Host cannot have more than one condition? Do we need to create the same Host for each condition?

(Edit) To clarify this example use case:
The main service will fall through to the main web server if no conditions are met.
We have one host for GraphQL - /graphql
We have a second host with our monolithic core (Loopback.js application) with /explorer and /api routes
I can’t set a single endpoint because the above /explorer is not nested within /api (or vice-versa)
Effectively these endpoints are being passed straight through as is


#2

If I understand your use case correctly, you can just do a single condition with “or”, like this:

req.url ~ "^/api" || req.url ~ "^/explore"

I hope that helps, let me know if not.


#3

Ah. Simple. Cheers drwilco


#4

Can also go even cleaner, if ((req.url ~ “(?i)^/(api|explore)”)