#POST request inside a worker (not working)

8 messages · Page 1 of 1 (latest)

raw trail
#

That's definitely doable, yes

#

My guess is your cors error means your worker is on a different domain to the browser?

#

If so, you'll need to send cors headers in your responses from your worker, same as any other server

#

Your worker will need to respond with cors headers (see the link above) so that your browser doesn't block the request

#

You can return whatever response you want

#

For example you might want to return something like new Response(null, { headers: "Access-Control-Allow-Origin": "*", status: 204 }) if you don't care about what the worker responds

#

(204 means an empty response)