File size: 500 Bytes
d7bca75
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
const TRAGET_HOST='hf4all-bingo.hf.space' // 请将此域名改成你自己的,域名信息在设置》站点域名查看。

export default {
  async fetch(request) {
    const uri = new URL(request.url);
    if (uri.protocol === 'http:') {
      uri.protocol = 'https:';
      return new Response('', {
        status: 301,
        headers: {
          location: uri.toString(),
        },
      })
    }
    uri.host = TRAGET_HOST
    return fetch(new Request(uri.toString(), request));
  },
};