Hi! We use Vercel Blob to store some assets that our users can download. This is one of them. We want to make sure we can switch the storage implementation if needed, so we don’t share these long blob-specific URLs. Instead we use our custom domain that rewrites to that long URL behind the scenes. So this is the same resource, just behind our domain.
But there’s an issue where the headers returned for the nice, short URL don’t include the content type:
curl --head https://assets.cesko.digital/935ccf9f.pdf
HTTP/2 200
access-control-allow-origin: *
cache-control: public, max-age=31536000, s-maxage=300
cf-cache-status: MISS
cf-ray: 8f35df5b5cc5d27c-FRA
content-disposition: inline; filename="935ccf9f.pdf"
content-security-policy: default-src 'none'; media-src 'self'; style-src 'unsafe-inline'; img-src 'self'
date: Tue, 17 Dec 2024 09:26:36 GMT
etag: W/"e037c22126b399f728950e26343318cf"
last-modified: Wed, 20 Nov 2024 11:51:38 GMT
server: Vercel
strict-transport-security: max-age=63072000
vary: Accept-Encoding
x-content-type-options: nosniff
x-vercel-id: fra1::s7fxp-1734427596027-6a3b25262544
x-vercel-origin: blob
Whereas the longer blob-specific response does include the content type:
curl --head https://Bbp30zNE50Ll9cz3.public.blob.vercel-storage.com/935ccf9f.pdf
HTTP/2 200
date: Tue, 17 Dec 2024 09:27:50 GMT
content-type: application/pdf
access-control-allow-origin: *
cache-control: public, max-age=31536000, s-maxage=300
content-disposition: inline; filename="935ccf9f.pdf"
content-security-policy: default-src 'none'; media-src 'self'; style-src 'unsafe-inline'; img-src 'self'
etag: W/"e037c22126b399f728950e26343318cf"
last-modified: Wed, 20 Nov 2024 11:51:38 GMT
vary: Accept-Encoding
x-content-type-options: nosniff
x-vercel-origin: blob
cf-cache-status: MISS
server: cloudflare
cf-ray: 8f35e12649f8f976-PRG
This makes the URL break in some browsers that don’t realize this is a PDF file. Is it possible to make this work?
PS. I have temporarily switched from rewrite to a redirect on the assets.cesko.digital domain to work around the issue in prod. Still would love to have it work with a rewrite instead.