CORS, S3 et client JS
BMPCreated with Sketch.BMPZIPCreated with Sketch.ZIPXLSCreated with Sketch.XLSTXTCreated with Sketch.TXTPPTCreated with Sketch.PPTPNGCreated with Sketch.PNGPDFCreated with Sketch.PDFJPGCreated with Sketch.JPGGIFCreated with Sketch.GIFDOCCreated with Sketch.DOC Error Created with Sketch.
question

CORS, S3 et client JS

Par
FXV
Créé le 2023-01-23 08:11:46 (edited on 2024-09-04 12:29:23) dans Stockage et Sauvegardes

Bonjour à toutes et à tous,

J'utilise Object Storage via l'api S3 (aws-sdk) en javascript.

Je développe un client JS qui upload un fichier via un presignedURL.

Lors de l'envoi de la requête PUT (via la méthode fetch native du navigateur) je me heurte à une erreur 403 (CORS Policy).

`Access to fetch at 'xxxx' from origin 'http://localhost:5173' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled.`

Sans passer par le navigateur, j'ai réussi à uploader le fichier
`node test-upload.js`

Avez vous une idée pour débloquer la situation ? merci !