All Collections
Gateways
How to fix 400 errors with Dedicated Gateways
How to fix 400 errors with Dedicated Gateways
'error while processing the Accept header: mime: unexpected content after media subtype\n' (also CORS can be a byproduct error)
Steve Simkins avatar
Written by Steve Simkins
Updated over a week ago

At the time of writing this article Pinata has updated to the latest version of IPFS. In this version there is an exception thrown when requesting content with an invalid Accept header mime type.

For example, if you have this type of request:

const axios = require('axios')

const incorrectHeader = async () => {
try {
const res = await axios.get('https://somegateway.mypinata.cloud/ipfs/QmeSjSinHpPnmXmspMjwiXyN6zS4E9zccariGR3jxcaWtq/8803', {
headers: {
'Accept': 'application/json, text/plain'
}
})
console.log("Correct Header Status:", res.data)
} catch (error) {
console.log(error)
}
}

incorrectHeader()

This will not work because the Accept header is not properly formatted for multiple types. There are other errors that have been proved to the IPFS team which we have reported and they are looking into it. In the meantime we would recommend using 'Accept':'text/plain'

const axios = require('axios')

const correctHeader = async () => {
try {
const res = await axios.get('https://somegateway.mypinata.cloud/ipfs/QmeSjSinHpPnmXmspMjwiXyN6zS4E9zccariGR3jxcaWtq/8803', {
headers: {
'Accept': 'text/plain'
}
})
console.log("Correct Header Status:", res.data)
} catch (error) {
console.log(error)
}
}

correctHeader()

If you have any other questions please contact us through our website or email [email protected]!

Did this answer your question?