Moved CORS code out to use plugin.