You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Ticket photos and oss.nbtca.space images download instead of displaying #239
@wen-templari Opening an event photo URL in a browser tab downloads the file instead of showing it. The same happens for any image on oss.nbtca.space, such as https://oss.nbtca.space/blog/clas/jnNsb2.png. <img> tags still render them.
sunday-res returns Content-Disposition: attachment and x-oss-force-download: true with x-oss-ec: 0048-00000105. That is OSS's forced-download rule for images served from the default domain of Hangzhou buckets created after 2019-09-30. oss.nbtca.space is affected too because the Tencent CDN reaches the origin with the default-domain Host. A signed response-content-disposition=inline does not override it.
Expected: images on oss.nbtca.space display in the browser, and event photo URLs use that domain.
Proposed fix, needing Tencent CDN access:
On oss.nbtca.space, add an HTTP response header rule that deletes Content-Disposition for jpg;jpeg;png;webp;gif only, so HTML and SVG keep the forced download.
Then switch the host of URLs from util.Photos.SignURL to oss.nbtca.space. The SDK signs with V1, which covers /bucket/key but not the host, and the CDN forwards the query string with the full query in its cache key. A real signed URL should be checked through the CDN first.
Alternatively, bind oss.nbtca.space to sunday-res in OSS and set the CDN origin Host and SNI to it. This is Aliyun's documented fix, but a mistake there breaks every existing image on the domain.
nbtca/Home#170 already shows ticket photos in an in-page viewer, so the ticket page works without this.
Activity