Implement CORS for upload endpoints.

Make upload endpoint work with ui plugin.