Enable providing custom CORS handler

Open up the option to provide a custom handler to check cross origin handling. This is needed (for example) for situations where CORS needs to be verified dynamically against allowed origins in a database