For the context, I'm creating presigned URL to upload to S3. For these requests the Cache-Control
header has to be set to the value public, max-age=31536000, immutable
.
I do the fetch with this code
fetch(
uploadUrl,
{
method: 'PUT',
cache: 'no-store',
headers: { 'Content-Type': contentType, 'Cache-Control': 'public, max-age=31536000, immutable' },
body: data
})
.then(response => {
if (response.ok) {
doneFunc(publicUrl);
} else {
failureFunc(response.status);
}
})
.catch(response => {
failureFunc(response.status);
});
With Chrome the PUT request is actually sent with the Cache-Control
header set in the fetch call public, max-age=31536000, immutable
With Firefox the PUT request is sent with the Cache-Control
header set to public, max-age=31536000, immutable, no-cache
. Notice the addition of no-cache
at the end. This addition makes my presigned URL not valid.
I tried by removing the cache parameter, by setting it to no-cache
and to no-store
. Firefox always adds something to the Cache-Control
header.
Do you know a way to make Firefox behaves like Chrome and respect the headers I set?