Skip to content

Commit

Permalink
update index
Browse files Browse the repository at this point in the history
  • Loading branch information
seadfeng committed Aug 6, 2024
1 parent 7d7ee68 commit ac1d200
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 3 deletions.
41 changes: 40 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,45 @@ A powerful and easy-to-use website mirroring tool based on Cloudflare Workers.
- 🌍 Bypass geographical restrictions
- ⚡ Improved access spee


## Two Types of Proxy Modes

- Single-Site Reverse Proxy
- Multi-Site Reverse Proxy


### Single-Site

You can use the workers.dev subdomain to access without needing your own domain. When deploying, configure the `proxySite` variable.

```js
// workers.dev/index.js
// replace to your proxy site domain
const proxySite = 'example.com';
```

Code: [workers.dev/index.js](workers.dev/index.js)

### Multi-Site

You need to have your own domain. The proxy site will be automatically recognized based on the domain name. After deployment, you only need to add custom domains according to the rules. Configure the `ownDomain` variable when deploying.

```js
// index.js
// replace to your domain
const ownDomain = "example.com";
```

The domain consists of two parts: proxy domain and own domain. For example:

Proxy site address: https://www.proxysites.ai.serp.ing

- **proxy domain**: www.proxysites.ai

- **own domain**: serp.ing

Code: [index.js](index.js)

## Local Deploy

### 1. install `wrangler`
Expand All @@ -32,7 +71,7 @@ Free domain name application:
```js
// index.js
// replace to your domain
const currentDomain = "example.com";
const ownDomain = "example.com";
```

#### Use workers.dev default domain?
Expand Down
4 changes: 2 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const getProxySite = (host, rootDomain) => {
return host.split(`.${rootDomain}`)[0];
}

const currentDomain = "serp.ing";
const ownDomain = "serp.ing";

async function handleRequest(request) {
const url = new URL(request.url);
Expand All @@ -19,7 +19,7 @@ Disallow: /
return new Response(robots,{ status: 200 });
}

const proxySite = getProxySite(host, currentDomain);
const proxySite = getProxySite(host, ownDomain);
const origin = `https://${proxySite}`;
const actualUrl = new URL(`${origin}${pathname}${url.search}${url.hash}`);

Expand Down

0 comments on commit ac1d200

Please sign in to comment.