Grails filters: can uri and uriExclude be used in the same filter?

226 Views Asked by At

I've defined a filter in grails like so:

securityFilter(uri: '/api/**', uriExclude: '/api/**/*skipthis*') {
   before {
       ...
       println request.url
   }
}

I was expecting it to handle any requests like /api/mything but ignore requests like /blahblah/mything/ and /api/mything/andskipthisthing requests yet my log reveals it's dutifully looking at /blahblah/mything

I understand that excludes take precedence, but I would have thought that would mean it would still only look at anything under /api/. I haven't seen any examples of excludeUri in my searches, and all the uri examples I see only use the uri and nothing else. Are we allowed to use excludeUri and uri together? Is this a bug in grails?

1

There are 1 best solutions below

0
GLaDOS On

Doh! I was looking at request.requestURL, which is the grails dispatcher url (ends with .dispatch) ... What I wanted was the request.forwardURI