Refactor CORS Middleware to be much faster (#7801)
* changes
* add changeset
* log
* add changeset
* changes
* changes
* lint
* middlware
* lint
* lint
* s
implified docstring
* fix
* revert test change
* docstring
* remove print
* update
---------
Co-authored-by: gradio-pr-bot <gradio-pr-bot@users.noreply.github.com>