Skip to content

Commit f1de735

Browse files
committed
show uv errors properly when cross origin isolated
1 parent 4b206e2 commit f1de735

2 files changed

Lines changed: 8 additions & 5 deletions

File tree

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@titaniumnetwork-dev/ultraviolet",
3-
"version": "3.0.0",
3+
"version": "3.0.1",
44
"description": "Highly sophisticated proxy used for evading internet censorship or accessing websites in a controlled sandbox using the power of service-workers and more!",
55
"main": "lib/index.cjs",
66
"license": "MIT",

src/uv.sw.js

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -556,7 +556,12 @@ function renderError(err, fetchedURL, bareServer) {
556556
* @type {string}
557557
*/
558558
let message;
559-
559+
let headers = {
560+
'content-type': 'text/html',
561+
};
562+
if (crossOriginIsolated) {
563+
headers['Cross-Origin-Embedder-Policy'] = 'require-corp';
564+
}
560565
if (isBareError(err)) {
561566
status = err.status;
562567
title = 'Error communicating with the Bare server';
@@ -582,9 +587,7 @@ function renderError(err, fetchedURL, bareServer) {
582587
),
583588
{
584589
status,
585-
headers: {
586-
'content-type': 'text/html',
587-
},
590+
headers: headers,
588591
}
589592
);
590593
}

0 commit comments

Comments
 (0)