-
Notifications
You must be signed in to change notification settings - Fork 22
/
_worker.js
34 lines (30 loc) · 1.04 KB
/
_worker.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
export default {
async fetch(request, env) {
try {
const url = new URL(request.url);
url.hostname = env.HOST || 'ictfz.ir';
url.protocol = 'https:';
// Forward the modified request
const newRequest = new Request(url, {
method: request.method,
headers: request.headers,
body: request.body,
redirect: request.redirect,
credentials: request.credentials,
});
return await fetch(newRequest);
} catch (error) {
return new Response(`Error: ${error.message}`, { status: 500 });
}
}
};
/*
export default {
async fetch(request, env) {
const url = new URL(request.url);
url.hostname = env.HOST || 'ictfz.ir';
url.protocol = 'https:';
request = new Request(url, request);
return fetch(request);
}
};*/