-
Notifications
You must be signed in to change notification settings - Fork 60.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
为什么cloudflare配置Gemini的代理用不了 #4783
Comments
Please follow the issue template to update title and description of your issue. |
Title: Why can’t cloudflare configure Gemini’s proxy? |
do you have any screenshot about error log? |
确实,隔壁lobe就能用cf的反代。 |
Indeed, the lobby next door can use the reverse generation of cf. |
只能说 OpenAI 支持的 IP 范围比 Gemini 宽松,不同公司不具备可比性 |
It can only be said that the IP range supported by OpenAI is looser than Gemini, and different companies are not comparable. |
不全是,我能够通过优选CF的入站节点控制其出站节点。
日志也没用什么。 |
Not really, I am able to control the outbound nodes via the inbound node of preferred CF. |
抢救不了半点? |
Can't save anything? |
const response = await fetch(modifiedRequest); |
const response = await fetch(modifiedRequest); |
const TELEGRAPH_URL = 'https://generativelanguage.googleapis.com/';
addEventListener('fetch', event => {
event.respondWith(handleRequest(event.request))
})
async function handleRequest(request) {
const url = new URL(request.url);
url.host = TELEGRAPH_URL.replace(/^https?:///, '');
const modifiedRequest = new Request(url.toString(), {
headers: request.headers,
method: request.method,
body: request.body,
redirect: 'follow'
});
const response = await fetch(modifiedRequest);
const modifiedResponse = new Response(response.body, response);
// 添加允许跨域访问的响应头
modifiedResponse.headers.set('Access-Control-Allow-Origin', '*');
return modifiedResponse;
}
我把openai的网址换成Gemini的为啥用不了,填openAI的网址国内可以访问。
The text was updated successfully, but these errors were encountered: