mirror of
https://github.com/Nezumi-2711/9router-config-generate.git
synced 2026-09-22 13:38:32 +00:00
fix: remove the proxy url
This commit is contained in:
@@ -37,29 +37,24 @@ After the first deployment, add a hostname in **Workers & Pages → 9router-conf
|
||||
|
||||
Do not protect the app or `/i/*` with Cloudflare Access if users must download install scripts via `curl` or PowerShell without signing in.
|
||||
|
||||
## Production model proxy
|
||||
## Gateway CORS requirement
|
||||
|
||||
The browser first requests `<gateway>/models` directly. If that gateway does not allow CORS, the app falls back to `/api/fetch-models` on the Worker.
|
||||
Models are requested directly from the Base URL entered by the user at `<gateway>/models`. This app does not proxy gateway requests through Cloudflare, so it works with any reachable gateway that permits cross-origin requests.
|
||||
|
||||
The Worker proxy is disabled by default and only accepts HTTPS gateway origins explicitly allowlisted through `MODEL_PROXY_ALLOWED_ORIGINS`. This prevents the public endpoint from becoming an open proxy.
|
||||
|
||||
Configure it in **Workers & Pages → 9router-config-generate → Settings → Variables and Secrets** as a plaintext variable:
|
||||
Configure each gateway to allow the deployed app origin and request headers:
|
||||
|
||||
```txt
|
||||
MODEL_PROXY_ALLOWED_ORIGINS=https://router.example.com,https://backup-router.example.com
|
||||
Access-Control-Allow-Origin: https://<your-app-domain>
|
||||
Access-Control-Allow-Methods: GET, OPTIONS
|
||||
Access-Control-Allow-Headers: Authorization, Content-Type
|
||||
```
|
||||
|
||||
Each value must be an HTTPS origin only: no path, query string, credentials, or wildcard. Deploy again after changing the variable.
|
||||
|
||||
> A Cloudflare Worker cannot reach `localhost` on a visitor's computer. For a local 9router gateway, configure that gateway's CORS policy to allow the deployed app origin instead. Use the Worker proxy only for publicly reachable HTTPS gateways.
|
||||
|
||||
The proxy forwards the API key supplied by the user for the single `/models` request. It does not store, log, or cache the key. Do not configure a shared 9router API key as a Worker variable or secret.
|
||||
For a local 9router gateway, allow the deployed app domain in its CORS configuration. Cloudflare cannot access `localhost` on a visitor's computer, but the visitor's browser can when the gateway permits that origin.
|
||||
|
||||
## Cloudflare resources used
|
||||
|
||||
- Cloudflare Workers
|
||||
- Workers Static Assets (`ASSETS` binding)
|
||||
- Optional custom domain
|
||||
- Optional plaintext variable: `MODEL_PROXY_ALLOWED_ORIGINS`
|
||||
|
||||
No KV, D1, R2, Queue, Durable Object, or Worker secret is required.
|
||||
|
||||
Reference in New Issue
Block a user