addHttpRequestHandler regex not matching

116 views Asked by At

I am attempting to match a regex pattern in the middle of an incoming request.

I have verified my regex pattern works with regex101.com.

The documentation states that addHttpRequestHandler regex will match anywhere given the correct pattern.

addHttpRequestHandler('/clinServicesScheduled',
'Scripts/clinServicesScheduled.js', 'clinServicesScheduled');

The above only matches at the beginning of the request.

What is the correct pattern to match in the middle of the request?

http://127.0.0.1/data/dashboard/community/communityCode/clinServicesScheduled/month/...

http://livedoc.wakanda.org/Global-Application/Application/addHttpRequestHandler.301-636268.en.html

/myPattern: intercepts any requests containing /myPattern regardless of its position in the string. This pattern will accept indifferently requests such as /files/myPattern, /myPattern.html, and /myPattern/bar.js.

1

There are 1 answers

3
Stefan On BEST ANSWER

try the following regex. it looks like wakanda always matches the urlPath from the beginning even though it is documented differently in the docs: http://doc.wakanda.org/home2.en.html#/Global-Application/Application/addHttpRequestHandler.301-636268.en.html

addHttpRequestHandler('.*/clinServicesScheduled', 'Scripts/clinServicesScheduled.js', 'clinServicesScheduled');

i have used this before to catch patterns in the middle of a request string