In my project, I want to whitelist a set of domains to handle requests. It should allow all requests from the listed domain, its sub-domains and different pages on the domain.
So, if, for example, one of the whitelisted domains is example.com, it should serve requests for www.example.com, abc.example.com, https://abc.def.example.com, example.com/pg1 etc.
Which is the best utility/ library that can be used for this purpose? Or, do I need to write my own regex?