Content-Type header in GetObject from S3

0

I have used the GetObject with Authorisation header; and a GET in the browser with a pre-signed url.

The content is returned but the Content-Type header shows 'junk'. The screen shot is attached .. I get the same value with GetObject and GET in the browser.

Thanks K Enter image description here

posta un anno fa2259 visualizzazioni
1 Risposta
0

When uploading an object to Amazon S3 you can specify a string as the Content-Type for an object. If a string is specified in the Content-Type, that value would override any guessed mime types by Amazon S3. It appears that when the object was uploaded to the bucket and random string of characters was added as the Content-Type for the object.

You can test this out by performing a HeadObject API call on the object via AWS CLI. You should find that the response contains the same Content-Type that you are seeing in your browser.

To correct this behavior, you should re-upload the object to the bucket without specifying any Content-Type in the PutObject request. Once uploaded, you can double-check the Content-Type by performing a HeadObject request. If you continue to receive this same behavior, you can try to specify manually specify the Content-Type for the object in the PutObject request. However, Amazon S3 follows RFC 9110 when it comes to the Content-Type header and should be able add a Content-Type that is not a random string of characters.

https://docs.aws.amazon.com/AmazonS3/latest/API/API_PutObject.html#API_PutObject_RequestSyntax https://www.rfc-editor.org/rfc/rfc9110.html#name-content-type

profile pictureAWS
con risposta un anno fa

Accesso non effettuato. Accedi per postare una risposta.

Una buona risposta soddisfa chiaramente la domanda, fornisce un feedback costruttivo e incoraggia la crescita professionale del richiedente.

Linee guida per rispondere alle domande