Question: ForwardAuth selective endpoints

Hi

Does any know how to apply the forwardAuth middleware on a service to just a selective set of endpoints ?

For instance, I don't want to apply the forwardAuth middleware to requests for CSS, JS and other static resources like images that do not require auth on my service providing the web UI.

I did try defining another router on the service that had the same Host(...) but with a PathPrefix(...) just set to the /api/ end points and applying the forwardAuth middleware to just that router, but it didn't work.

Possibly something to do with me setting up the router but I can't find any examples of similar setups where the forwardAuth is only to be applied to a sub-set of endpoints.

Suggestions here would be great.

FYI
This does now work after applying the the middleware to the correct router, small oversight in my stack yml files configuration.

Now I just need to work out a regexp that excludes all the endpoints I don't want to apply the auth middleware too.