CORS erreur avec Object Storage
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 erreur avec Object Storage

Par
KevinB48
Créé le 2022-04-14 15:15:49 (edited on 2024-09-04 12:12:44) dans Public Cloud OVHcloud

Bonjour,

Je fais appel à votre aide car j'ai un problème de CORS que je n'arrive pas à régler.

J'ai des images stockées dans un container OBJECT STORAGE (Swift). Lorsque j'essais de les afficher dans mon application typescript cela fonctionne correctement.
Mais lorsque j'essais de les récupérer via des librairies (react-pdf, graph etc), je reçois une erreur CORS :
> Access to XMLHttpRequest at 'https://storage.sbg.cloud.ovh.net/...' from origin 'http://localhost:3000' 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.

J'ai configuré mon container comme indiqué ici , avec ''X-Container-Meta-Access-Control-Allow-Origin: http://localhost:3000' mon_container" mais également avec '*', mais cela ne fonctionne pas.

Avez-vous une piste à creuser ou une solution? A moins que cela corresponde au message
> CORS n’est pas compatible avec l’API S3.

de la documentation, et donc est-ce que quelqu'un à une solution pour contourner le problème?

Merci d'avance pour vos réponses