Skip to content

Commit 7016d4e

Browse files
committed
fix: change fetch method from HEAD to GET with Range header for better CDN/CORS handling
1 parent 9977780 commit 7016d4e

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

custom/preview.vue

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,10 @@ onMounted(async () => {
8484
if (Array.isArray(url.value)) return;
8585
try {
8686
const response = await fetch(url.value, {
87-
method: 'HEAD',
87+
method: 'GET',
88+
headers: {
89+
Range: 'bytes=0-0' // this approach is better then HEAD in terms of CDN/CORS, but same for efficiency as HEAD
90+
},
8891
mode: 'cors',
8992
});
9093
const ct = response.headers.get('Content-Type');

0 commit comments

Comments
 (0)