Upload to CF Images API from localhost?

I can imagine someone has asked this already and I just can’t find the post; but I am attempting a post request from my localhost. This POST contains a FileList (is this valid to upload? or do i need to make a singular request for each File??) and just logs the response for now.

            headers: {
                'Authorization': 'Bearer <<TOKEN>>',
                'Content-Type': 'application/json'
        .then((res) => {
            console.log('success!', res)
        .catch((err) => {
            console.log('error!', err)

However my requests (and pre-flight requests) are failing due to cors. For this use case I am not interacting with a backend in any way. Is there still a way to develop locally with CF Images without setting up proxy middleware on a server?

API requests were never meant to be called from the browser: that will be a footgun leading users to accidentally leak API access token to the public.

API service doesn’t return CORS headers.

Hello @asemiglazov.
I am also attempting to do upload images with Direct Creator Upload from the frontend, but I keep having CORS errors. Is this perhaps the reason?

Will we be able to make these requests from the browsers in the future?

This topic was automatically closed after 15 days. New replies are no longer allowed.