English | 简体中文
Support cross-domain request
Convert HTTP to HTTPS
https://example.com/{URL}
https://example.com/https://api.github.com
https://example.com/http://nginx.org/download/nginx-1.20.2.tar.gz
// Copy to the console and run
var $url = "http://wthrcdn.etouch.cn/weather_mini?citykey=101040100";
fetch("https://example.com/" + $url).then(x => x.text()).then(console.log)
The mechanism of both methods is the same
- Clone the project and enter the cors directory
- Edit
index.js
andwrangler.toml
(configuration key) wrangler config
configure mailbox and keywrangler build
buildwrangler publish
release- Detailed documentation: https://developers.cloudflare.com/workers/quickstart
- Turn to Cloudflare Dashboard, then switch to the
Workers
tab Create a service
Quick edit
- Clear the editor
- Copy the code from
cors/index.js
to the editor (if you don't care about logging,pages/_worker.js
is another choice) - Edit the configurations if necessary
Save and Deploy
CPU | Daily request | Burst rate | Script size |
---|---|---|---|
10ms | 100,000 | 1000 requests in 10 minutes | 1M after compression |
Details: https://developers.cloudflare.com/workers/about/limits/
The amount can't hold up, please use your account to build the service if you use a lot, thank you! ! !
https://example.com/{URL}
https://example.com/https://api.github.com
https://example.com/http://nginx.org/download/nginx-1.20.2.tar.gz
The mechanism of both methods is the same
npm install wrangler@beta # install
npx wrangler pages dev --help # View help (nodejs version >= 16.x)
npx wrangler pages dev ./ # Enter the pages directory and run
Details: https://developers.cloudflare.com/pages/platform/functions
- Fork this repository
- Edit the configurations in
pages/_worker.js
if necessary - Turn to Cloudflare Dashboard, then switch to the
Pages
tab Create a project ▼
->Connect to Git
- Connect to your GitHub account, then select the fork created just now
Begin setup
- Fill in
Build settings
:Framework preset
-None
;Build command
- leave it blank;Build output directory
-pages
Save and Deploy
The total number of invocation requests per day is capped at 100,000. If the daily limit is reached, Pages will stop executing the function and fall back to providing only static resources.